All Algorithms implemented in Python the-algorithms.com/
Go to file
Hrishikesh Suslade 4590363806 Added Pytests for Decission Tree mean_squared_error method (#1374)
* 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
```
2019-10-18 20:23:37 +02:00
.github Update stale.yml 2019-08-29 00:53:42 +05:30
arithmetic_analysis psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
backtracking psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
blockchain Add Topological Sort (#1302) 2019-10-18 08:13:58 +02:00
boolean_algebra psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
ciphers Add unicode support in ciphers/base64_cipher.py script. (#1316) 2019-10-18 08:35:13 +02:00
compression psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
conversions psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
data_structures Update treap.py (#1358) 2019-10-18 09:39:37 +02:00
digital_image_processing psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
divide_and_conquer mergesort added (#1313) 2019-10-10 00:12:09 +05:00
dynamic_programming Adding doctests for fractional_knapsack.py (#1331) 2019-10-18 08:13:20 +02:00
file_transfer psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
graphs Add Topological Sort (#1302) 2019-10-18 08:13:58 +02:00
hashes psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
linear_algebra Fixing Some Minor Issues (#1386) 2019-10-17 20:13:28 +02:00
machine_learning Added Pytests for Decission Tree mean_squared_error method (#1374) 2019-10-18 20:23:37 +02:00
maths Add Topological Sort (#1302) 2019-10-18 08:13:58 +02:00
matrix psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
networking_flow psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
neural_network psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
other psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
project_euler Added missing problem statements (#1364) 2019-10-18 06:46:13 +02:00
scripts psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
searches added fibonacci_search.py (#1341) 2019-10-18 08:10:08 +02:00
sorts Add Topological Sort (#1302) 2019-10-18 08:13:58 +02:00
strings psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
traversals psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
.gitignore Update .gitignore to remove __pycache__/ (#1127) 2019-08-17 00:46:33 +02:00
.travis.yml Add Flake8 F4 Tests to .travis.yml (#974) 2019-09-13 14:07:24 +02:00
CONTRIBUTING.md CONTRIBUTING.md: Fix mistake in doctest ;-) (#1266) 2019-10-05 23:32:58 +08:00
DIRECTORY.md Fixed links in DIRECTORY.md (#1291) 2019-10-07 23:23:46 +05:00
LICENSE.md Create CONTRIBUTING.md (#864) 2019-06-02 12:14:18 +08:00
README.md Update build badge (#1378) 2019-10-17 16:02:40 +02:00
requirements.txt Travis CI: Add pytest --doctest-modules machine_learning (#1016) 2019-08-10 22:48:00 +02:00

The Algorithms - Python

Donate  Build Status  LGTM  Gitter chat  contributions welcome   

All algorithms implemented in Python (for education)

These implementations are for learning purposes. They may be less efficient than the implementations in the Python standard library.

Contribution Guidelines

Read our Contribution Guidelines before you contribute.

Open in Gitpod

Community Channel

We're on Gitter! Please join us.

Algorithms

See our directory.