scipyscipy functions
would you use for each?# import the necessary libraries
import numpy as np
import scipy.stats as stats
# create sample data
data_group1 = np.array([14, 15, 15, 16, 13, 8, 14,
17, 16, 14, 19, 20, 21, 15,
15, 16, 16, 13, 14, 12])
data_group2 = np.array([15, 17, 14, 17, 14, 8, 12,
19, 19, 14, 17, 22, 24, 16,
13, 16, 13, 18, 15, 13])# Your code here!scipysine_fit that accepts an independent
variable (your data), the amplitude, and the phase shift of a sine wave
and returns the resulting y-valuescipy's curve_fit to estimate the
parameters of your sample data (Hint: the first argument is your
callable sine_fit function)np.random.normal to create the sample data? How does
knowing the sample data takes the form of a sine wave help inform the
way you define sine_fit?# import the necessary libraries
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
# create sample data
x = np.linspace(0, 10, num = 40)
y = 3.45 * np.sin(1.334 * x) + np.random.normal(size = 40)# Your code here!sensitivityx1 and x2
are the keysSensitivityAnalyzer and my_model to
obtain a DataFrame and hexbin plot of the resultsx3 with values [5, 10, 15]
to your dictionarymy_model2x1, x2, and x3 based on
my_model2my_model
and my_model2 represent in this example? How is the
sensitivity between x1 and x2 different from
the sensitvity between x2 and x3 for the given
my_model2?# import the necessary libraries
import pandas as pd
from sensitivity import SensitivityAnalyzer
# define some functions for known models
def my_model(x1, x2):
return x1 ** x2
def my_model2(x1, x2, x3):
return x1 * x2 ** x3
# create sample data
x1_vals = [10, 20, 30]
x2_vals = [1, 2, 3]