Repository: TheAlgorithms/Python

Issue:
[PYTEST WARNING] Decision tree
### Feature description

@nbrgr @hrishi84 @cclauss Please could you resolve this warning
```
machine_learning/decision_tree.py::machine_learning.decision_tree.DecisionTree.mean_squared_error
  <doctest machine_learning.decision_tree.DecisionTree.mean_squared_error[2]>:1: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

machine_learning/decision_tree.py::machine_learning.decision_tree.DecisionTree.mean_squared_error
machine_learning/decision_tree.py::machine_learning.decision_tree.DecisionTree.mean_squared_error
  /home/runner/work/Python/Python/machine_learning/decision_tree.py:148: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    squared_error_sum = np.float(0)

machine_learning/decision_tree.py::machine_learning.decision_tree.DecisionTree.mean_squared_error
machine_learning/decision_tree.py::machine_learning.decision_tree.DecisionTree.mean_squared_error
  /home/runner/work/Python/Python/machine_learning/decision_tree.py:152: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    return np.float(squared_error_sum / labels.size)

machine_learning/decision_tree.py::machine_learning.decision_tree.DecisionTree.mean_squared_error
  <doctest machine_learning.decision_tree.DecisionTree.mean_squared_error[5]>:1: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
```

origin: #7211


Discussion:

Resolving patch:
diff --git a/machine_learning/decision_tree.py b/machine_learning/decision_tree.py
--- a/machine_learning/decision_tree.py
+++ b/machine_learning/decision_tree.py
@@ -24,13 +24,13 @@ def mean_squared_error(self, labels, prediction):
             estimate the labels
         >>> tester = DecisionTree()
         >>> test_labels = np.array([1,2,3,4,5,6,7,8,9,10])
-        >>> test_prediction = np.float(6)
+        >>> test_prediction = float(6)
         >>> tester.mean_squared_error(test_labels, test_prediction) == (
         ...     TestDecisionTree.helper_mean_squared_error_test(test_labels,
         ...         test_prediction))
         True
         >>> test_labels = np.array([1,2,3])
-        >>> test_prediction = np.float(2)
+        >>> test_prediction = float(2)
         >>> tester.mean_squared_error(test_labels, test_prediction) == (
         ...     TestDecisionTree.helper_mean_squared_error_test(test_labels,
         ...         test_prediction))
@@ -145,11 +145,11 @@ def helper_mean_squared_error_test(labels, prediction):
         @param prediction: a floating point value
         return value: helper_mean_squared_error_test calculates the mean squared error
         """
-        squared_error_sum = np.float(0)
+        squared_error_sum = float(0)
         for label in labels:
             squared_error_sum += (label - prediction) ** 2
 
-        return np.float(squared_error_sum / labels.size)
+        return float(squared_error_sum / labels.size)
 
 
 def main():


Test patch: