<jupyter_start><jupyter_text>Sequential Approximation<jupyter_code>import matplotlib
from matplotlib import interactive
interactive(True)

import numpy as np
import pandas as pd

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import sys
# import core methods - Allow to run standalone in Google Collab
!git clone https://github.com/PML-UCF/SequentialResponseSurface.git
from SequentialResponseSurface.core import ResponseSurface, GenerateGrid, NewSamples
# Mount Google Drive folder and create PML folder
from google.colab import drive
drive.mount('/content/drive/')
data = pd.read_excel('drive/My Drive/PML/doe.xlsx')
inputs = data[['x1','x2']]
output = data['y']
MyResponseSurface = ResponseSurface(inputs, output)

varlimits = np.array([[2,6],[.75,3]])
selectvar = [0,1]

Grid = GenerateGrid(MyResponseSurface, varlimits, selectvar)
# Sequential Approximation
points = 10
new = NewSamples(inputs,output,varlimits,points)
# Save DoE data to Google Drive PML folder
new.to_excel('drive/My Drive/PML/new_doe.xlsx')
nptns = np.shape(data)[0]
new_inputs = new[['x1','x2']].values[nptns:nptns+points,:]
new_output = MyResponseSurface.predict(new_inputs)

fig = plt.figure(figsize=(8.6, 6.6))
ax = Axes3D(fig)
ax.set_xlabel('Rotor radius (in)',fontsize = 14)
ax.set_ylabel('Rotor width (in)',fontsize = 14)
ax.set_zlabel('Flight time (s)',fontsize = 14)
ax.view_init(elev=None, azim=135)

ax.scatter(xs = inputs['x1'], ys = inputs['x2'], zs = output, s=50, c='r')
ax.view_init(elev=None, azim=135)

ax.plot_surface(Grid['input1'], Grid['input2'], Grid['output'], shade = True, alpha = 0.5)
fig = plt.figure(figsize=(8.6, 6.6))
plt.scatter(new['x1'],new['x2'], color = 'k')
plt.scatter(inputs['x1'],inputs['x2'], color = 'r')
plt.xlabel('Rotor radius (in)',fontsize = 14)
plt.ylabel('Rotor width (in)',fontsize = 14)
fig = plt.figure(figsize=(8.6, 6.6))
ax = Axes3D(fig)
ax.set_xlabel('Rotor radius (in)',fontsize = 14)
ax.set_ylabel('Rotor width (in)',fontsize = 14)
ax.set_zlabel('Flight time (s)',fontsize = 14)
ax.view_init(elev=None, azim=135)

ax.scatter(xs = inputs['x1'], ys = inputs['x2'], zs = output, s=50, c='r')
ax.scatter(xs = new_inputs[:,0], ys = new_inputs[:,1], zs = new_output, s=50, c='k')
ax.view_init(elev=None, azim=135)

ax.plot_surface(Grid['input1'], Grid['input2'], Grid['output'], shade = True, alpha = 0.5)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17148846960167716, 'fraction_numerical': 0.034381551362683435, 'mean_word_length': 6.696774193548387, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '548866', 'license': 'MIT', 'n_tokens_mistral': 954, 'n_tokens_neox': 914, 'n_words': 195, 'path': '2_Sequential_Approximation.ipynb', 'repo_name': 'PML-UCF/SequentialResponseSurface', 'size': '2385'}