├── nlp-1.py ├── 1.py ├── 2.py └── 3.py /nlp-1.py: -------------------------------------------------------------------------------- 1 | import urllib.request 2 | 3 | response = urllib.request.urlopen('http://somiljain.me/') 4 | 5 | html = response.read() 6 | 7 | print (html) 8 | -------------------------------------------------------------------------------- /1.py: -------------------------------------------------------------------------------- 1 | import tensorflow as tf 2 | from tensorflow.keras import Sequential 3 | from tensorflow.keras.layers import Dense 4 | 5 | model = Sequential() 6 | model.add(Dense(3, input_dim=2 ,activation='relu')) 7 | model.add(Dense(1, activation='softmax')) 8 | 9 | -------------------------------------------------------------------------------- /2.py: -------------------------------------------------------------------------------- 1 | import tensorflow as tf 2 | from tensorflow.keras import Model 3 | from tensorflow.keras.layers import Dense 4 | 5 | class SimpleNeuralNetwork(Model): 6 | def __init__(self): 7 | super(SimpleNeuralNetwork , self).__init__() 8 | self.layer1 = Dense(2,activation='relu') 9 | self.layer2 = Dense(3,activation='relu') 10 | self.outputLayer = Dense(1,activation='softmax') 11 | def call(self, x): 12 | x = self.layer1(x) 13 | x = self.layer2(x) 14 | return self.outputLayer(x) 15 | 16 | Model = SimpleNeuralNetwork() 17 | 18 | 19 | -------------------------------------------------------------------------------- /3.py: -------------------------------------------------------------------------------- 1 | import quandl 2 | import numpy as np 3 | from sklearn.linear_model import LinearRegression 4 | from sklearn.svm import SVR 5 | from sklearn.model_selection import train_test_split 6 | # Get the stock data 7 | df = quandl.get("WIKI/AMZN") 8 | # Take a look at the data 9 | # Get the Adjusted Close Price 10 | df = df[['Adj. Close']] 11 | # A variable for predicting 'n' days out into the future 12 | forecast_out = 30 #'n=30' days 13 | #Create another column (the target ) shifted 'n' units up 14 | df['Prediction'] = df[['Adj. Close']].shift(-forecast_out) 15 | #print the new data set 16 | print(df.tail()) 17 | X = np.array(df.drop(['Prediction'],1)) 18 | 19 | #Remove the last '30' rows 20 | X = X[:-forecast_out] 21 | print(X) 22 | ### Create the dependent data set (y) ##### 23 | # Convert the dataframe to a numpy array 24 | y = np.array(df['Prediction']) 25 | # Get all of the y values except the last '30' rows 26 | y = y[:-forecast_out] 27 | print(y) 28 | # Split the data into 80% training and 20% testing 29 | x_train, x_test, y_train, y_test = train_test_split(X, y, test_size=0.2) 30 | # Create and train the Support Vector Machine (Regressor) 31 | svr_rbf = SVR(kernel='rbf', C=1e3, gamma=0.1) 32 | svr_rbf.fit(x_train, y_train) 33 | 34 | --------------------------------------------------------------------------------