In [90]:
#import sklearn
import numpy as np
from scipy.stats import beta
import matplotlib.pyplot as plt
import scipy.stats as st
from mpl_toolkits.mplot3d import Axes3D
x_rand = np.random.random_sample(100)
mean = []
var = []
median = []
mode = []
kurt = []
skew = []
#fig, axs = plt.subplots(1,7)
ax1 = []
ax2 = []
fig = plt.figure()
for i in np.arange(1,5,1):
for j in np.arange(1,5,1):
y = beta.pdf(x_rand,i,j)
mean = mean + [np.mean(y)]
var = var + [np.var(y)]
median = median + [np.median(y)]
mode = mode + [st.mode(y)]
kurt = kurt + [st.kurtosis(y)]
skew = skew + [st.skew(y)]
ax1 += [i]
ax2 += [j]
plt.scatter(x_rand,y)
plt.show()
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(ax1, ax2 ,mean)
ax.scatter(ax1, ax2 ,median)
#ax.scatter(ax1, ax2 ,mode)
ax.scatter(ax1, ax2 ,var)
ax.scatter(ax1, ax2 ,kurt)
ax.scatter(ax1, ax2 ,skew)
plt.show()
In [119]:
import pandas as pd
import seaborn as sns
%matplotlib inline
xl = pd.ExcelFile("slr04.xls")
df = xl.parse('Sheet 1')
print(df)
sns.lmplot("X", "Y", df);
sns.jointplot("X", "Y", df, kind='reg');
In [133]:
import matplotlib.pyplot as plt
import numpy as np
from sklearn import datasets, linear_model
# Load the dataset
xl = pd.ExcelFile("slr04.xls")
df = xl.parse('Sheet 1')
# Use only one feature
# Split the data into training/testing sets
datos=df.values
print(datos[0][0])
#diabetes_X_train = diabetes_X[:-20]
#diabetes_X_test = diabetes_X[-20:]
# Split the targets into training/testing sets
#diabetes_y_train = diabetes.target[:-20]
#diabetes_y_test = diabetes.target[-20:]
# Create linear regression object
#regr = linear_model.LinearRegression()
# Train the model using the training sets
#regr.fit(diabetes_X_train, diabetes_y_train)
# The coefficients
#print('Coefficients: \n', regr.coef_)
# The mean squared error
#print("Mean squared error: %.2f"
# % np.mean((regr.predict(diabetes_X_test) - diabetes_y_test) ** 2))
# Explained variance score: 1 is perfect prediction
#print('Variance score: %.2f' % regr.score(diabetes_X_test, diabetes_y_test))
# Plot outputs
#plt.scatter(diabetes_X_test, diabetes_y_test, color='black')
#plt.plot(diabetes_X_test, regr.predict(diabetes_X_test), color='blue',
# linewidth=3)
#plt.xticks(())
#plt.yticks(())
#plt.show()
In [ ]:
In [ ]:
In [ ]:
#