mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-19 19:03:02 +08:00
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
This commit is contained in:
@ -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.title('Random Forest Classification (Test set)')
|
||||
plt.xlabel('Age')
|
||||
plt.ylabel('Estimated Salary')
|
||||
plt.legend()
|
||||
plt.show()
|
||||
plt.show()
|
||||
|
Reference in New Issue
Block a user