* Added Random Forest Regressor
* Updated file to standard
* Added Random Forest Classifier (Iris dataset) and a Confusion Matrix for result visualization
* spelling corrections
* review
* improved documentation, removed redundant variables, added testing
* added type hint
* camel case to snake case
* spelling fix
* review
* python --> Python # it is a brand name, not a snake
* explicit cast to int
* spaces in int list
* "!= None" to "is not None"
* Update comb_sort.py
* various spelling corrections in documentation & several variables naming conventions fix
* + char in file name
* import dependency - bug fix
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Adding doctests into <gaussian_distribution> function
* Adding doctests into <y_generator> function
* Adding doctests into <calculate_mean> function
* Adding doctests into <calculate_probabilities> function
* Adding doctests into <calculate_variance> function
* Adding doctests into <predict_y_values> function
* Adding doctests into <accuracy> function
* fixup! Format Python code with psf/black push
* Update convex_hull.py
* Update convex_hull.py
* Simplify sudoku.is_completed() using builtin all()
Simplify __sudoku.is_completed()__ using Python builtin function [__all()__](https://docs.python.org/3/library/functions.html#all).
* fixup! Format Python code with psf/black push
* Update sudoku.py
* fixup! Format Python code with psf/black push
* Old style exception -> new style for Python 3
* updating DIRECTORY.md
* Update convex_hull.py
* fixup! Format Python code with psf/black push
* e.args[0] = "msg"
* ValueError: could not convert string to float: 'pi'
* Update convex_hull.py
* fixup! Format Python code with psf/black push
* converting generator object to a list object
* Refactor: converting generator object to a list object
* fixup! Format Python code with psf/black push
* Adding new file to the machine_learning directory
* Adding initial documentation
* importing modules
* Adding Normal_gen function
* Adding Y_gen function
* Adding mean_calc function
* Adding prob_calc function
* Adding var_calc function
* Adding predict function
* Adding accuracy function
* Adding main function
* Renaming LDA file
* Adding requested changes
* Renaming some of functions
* Refactoring str.format() statements to f-string
* Removing unnecessary list objects inside two functions
* changing code style in some lines
* Fixing y_generator function
* Refactoring 'predict_y_values' function by using list comprehensions
* Changing code style in import statements
* Refactoring CLI code block
* fixup! Format Python code with psf/black push
* No lines longer than 88 characters
* Remove code with side effects from main
When running tests withy pytest, some modules execute code in main scope
and open plot or browser windows.
Moves such code under `if __name__ == "__main__"`.
* fixup! Format Python code with psf/black push
* Added Pytests for Decission Tree
Modified the mean_squared_error to be a static method
Created the Test_Decision_Tree class
Consists of two methods
1. helper_mean_squared_error_test: This method calculates the mean squared error manually without using
numpy. Instead a for loop is used for the same.
2. test_one_mean_squared_error: This method considers a simple test case and compares the results by the
helper function and the original mean_squared_error method of Decision_Tree class. This is done using asert
keyword.
Execution:
PyTest installation
pip3 install pytest OR pip install pytest
Test function execution
pytest decision_tree.py
* Modified the pytests to be compatible with the doctest
Added 2 doctest in the mean_squared_error method
For its verification a static method helper_mean_squared_error(labels, prediction) is used
It uses a for loop to calculate the error instead of the numpy inbuilt methods
Execution
```
pytest .\decision_tree.py --doctest-modules
```
* Added dbscan in two formats. A jupyter notebook file for the
storytelling and a .py file for people that just want to look at the
code. The code in both is essentially the same. With a few things
different in the .py file for plotting the clusters.
* fixed LGTM problems
* Some requested changes implemented.
Still need to do docstring
* implememted all changes as requested
* svm.py
for issue #840
I would like to add the Support Vector Machine algorithm implemented in Python 3.6.7
Requirements:
- sklearn
* update svm.py
* update svm.py
* Update and renamed to sorted_vector_machines.py
* Updated sorted_vector_machines.py
* 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
I've implemented a basic decision tree in python as an example of how they work. Although the class I've created only works on one dimensional data sets, the reader should be able to generalize it to higher dimensions should they need to.