Skip to content

Travis CI: Add pytest --doctest-modules machine_learning #1016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 0 additions & 124 deletions machine_learning/perceptron.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# Random Forest Classification

# Importing the libraries
import os
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

# Importing the dataset
dataset = pd.read_csv('Social_Network_Ads.csv')
script_dir = os.path.dirname(os.path.realpath(__file__))
dataset = pd.read_csv(os.path.join(script_dir, 'Social_Network_Ads.csv'))
X = dataset.iloc[:, [2, 3]].values
y = dataset.iloc[:, 4].values

# Splitting the dataset into the Training set and Test set
from sklearn.cross_validation import train_test_split
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25, random_state = 0)

# Feature Scaling
Expand Down Expand Up @@ -66,4 +68,4 @@
plt.xlabel('Age')
plt.ylabel('Estimated Salary')
plt.legend()
plt.show()
plt.show()
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Random Forest Regression

# Importing the libraries
import os
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

# Importing the dataset
dataset = pd.read_csv('Position_Salaries.csv')
script_dir = os.path.dirname(os.path.realpath(__file__))
dataset = pd.read_csv(os.path.join(script_dir, 'Position_Salaries.csv'))
X = dataset.iloc[:, 1:2].values
y = dataset.iloc[:, 2].values

Expand All @@ -28,7 +30,7 @@
regressor.fit(X, y)

# Predicting a new result
y_pred = regressor.predict(6.5)
y_pred = regressor.predict([[6.5]])

# Visualising the Random Forest Regression results (higher resolution)
X_grid = np.arange(min(X), max(X), 0.01)
Expand All @@ -38,4 +40,4 @@
plt.title('Truth or Bluff (Random Forest Regression)')
plt.xlabel('Position level')
plt.ylabel('Salary')
plt.show()
plt.show()
8 changes: 4 additions & 4 deletions neural_network/perceptron.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ def sign(self, u):

exit = [-1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1]

if __name__ == '__main__':
network = Perceptron(sample=samples, exit = exit, learn_rate=0.01, epoch_number=1000, bias=-1)
network = Perceptron(sample=samples, exit = exit, learn_rate=0.01, epoch_number=1000, bias=-1)

network.training()
network.training()

if __name__ == '__main__':
while True:
sample = []
for i in range(3):
sample.insert(i, float(input('value: ').strip()))
sample.insert(i, float(input('value: ')))
network.sort(sample)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ opencv-python
pandas
pillow
pytest
requests
sklearn
sympy
tensorflow