Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
Permalink
Browse files

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

* Travis CI: Add pytest --doctest-modules neural_network

Fixes #987
```
neural_network/perceptron.py:123: in <module>
    sample.insert(i, float(input('value: ')))
../lib/python3.7/site-packages/_pytest/capture.py:693: in read
    raise IOError("reading from stdin while output is captured")
E   OSError: reading from stdin while output is captured
-------------------------------------------------------------------------------- Captured stdout --------------------------------------------------------------------------------
('\nEpoch:\n', 399)
------------------------

value:
```

* Adding fix from #1056 -- thanks @QuantumNovice

* if __name__ == '__main__':

* pytest --ignore=virtualenv  # do not test our dependencies
  • Loading branch information...
cclauss committed Aug 10, 2019
1 parent 91c3c98 commit 36684db2780d695add9bd0a4523d73496cb35664

This file was deleted.

@@ -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
@@ -66,4 +68,4 @@
plt.xlabel('Age')
plt.ylabel('Estimated Salary')
plt.legend()
plt.show()
plt.show()
@@ -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

@@ -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)
@@ -38,4 +40,4 @@
plt.title('Truth or Bluff (Random Forest Regression)')
plt.xlabel('Position level')
plt.ylabel('Salary')
plt.show()
plt.show()
@@ -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)
@@ -7,6 +7,7 @@ opencv-python
pandas
pillow
pytest
requests
sklearn
sympy
tensorflow

0 comments on commit 36684db

Please sign in to comment.
You can’t perform that action at this time.