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');


*** No CODEPAGE record, no encoding_override: will use 'ascii'
      X    Y
0   2.9  4.0
1   6.7  7.4
2   4.9  5.0
3   7.9  7.2
4   9.8  7.9
5   6.9  6.1
6   6.1  6.0
7   6.2  5.8
8   6.0  5.2
9   5.1  4.2
10  4.7  4.0
11  4.4  4.4
12  5.8  5.2
/home/foxtrot/anaconda3/lib/python3.6/site-packages/statsmodels/nonparametric/kdetools.py:20: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  y = X[:m/2+1] + np.r_[0,X[m/2+1:],0]*1j

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()


*** No CODEPAGE record, no encoding_override: will use 'ascii'
[ 2.9000001  4.       ]

In [ ]:


In [ ]:


In [ ]:
#