Skip to content

Commit

Permalink
VerticaPy Documentation Update : Fixed link + RFClassifier description (
Browse files Browse the repository at this point in the history
#1241)

* corrected features engineering page link for docs

* updated doc/description for RandomForestClassifier

* correcting unit tests

* Update test_tree_model.py

* version

---------

Co-authored-by: Badr <[email protected]>
  • Loading branch information
mail4umar and oualib authored Jun 22, 2024
1 parent 490e6ef commit 6e1432a
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 19 deletions.
4 changes: 2 additions & 2 deletions docs/source/user_guide_data_preparation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Data Preparation
.. grid-item::

.. card:: Feature engineering
:link: notebooks/data_prep/featrues_engineering/index.html
:link: notebooks/data_prep/features_engineering/index.html
:text-align: center
:class-card: custom-card-13

Expand All @@ -121,7 +121,7 @@ Data Preparation
notebooks/data_prep/decomposition/index.ipynb
notebooks/data_prep/duplicates/index.ipynb
notebooks/data_prep/encoding/index.ipynb
notebooks/data_prep/featrues_engineering/index.ipynb
notebooks/data_prep/features_engineering/index.ipynb
notebooks/data_prep/joins/index.ipynb
notebooks/data_prep/missing_values/index.ipynb
notebooks/data_prep/normalization/index.ipynb
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

setuptools.setup(
name="verticapy",
version="1.0.3",
version="1.0.4",
author="Badr Ouali",
author_email="[email protected]",
url="https://github.com/vertica/VerticaPy",
Expand Down
6 changes: 3 additions & 3 deletions verticapy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
)
__url__: str = "https://github.com/vertica/verticapy/"
__license__: str = "Apache License, Version 2.0"
__version__: str = "1.0.3"
__version__: str = "1.0.4"
__iteration__: int = 1
__date__: str = "05172024"
__last_commit__: str = "916be8bc734a83d5e7f71ee6737cac7ec4b1a686"
__date__: str = "06222024"
__last_commit__: str = "b37e103cd5fbfea64eb167d42dcf2cdaad99fd75"
__long_version__: str = f"{__version__}-{__iteration__}{__date__}-{__last_commit__}"
__codecov__: float = 0.8316

Expand Down
22 changes: 15 additions & 7 deletions verticapy/machine_learning/vertica/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -1846,13 +1846,21 @@ def to_memmodel(self) -> mm.XGBRegressor:

class RandomForestClassifier(MulticlassClassifier, RandomForest):
"""
Creates a ``RandomForestClassifier``
object using the Vertica RF_CLASSIFIER
function. It is an ensemble learning
method for classification that operates
by constructing a multitude of decision
trees at training-time and outputting a
class with the mode.
Creates a RandomForestClassifier object
using the Vertica RF_CLASSIFIER function.
It is an ensemble learning method for
classification that operates by constructing
a multitude of decision trees during
training and predicting the class by using
a majority voting strategy among the
individual trees.
The classifier aggregates the predictions
of multiple decision trees to determine
the final output class, thus improving
the overall prediction accuracy and
robustness compared to a single decision
tree.
Parameters
----------
Expand Down
7 changes: 7 additions & 0 deletions verticapy/tests/vModel/test_xgb_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import pytest

# Standard Python Modules
import sys
import os

# Other Modules
Expand Down Expand Up @@ -561,6 +562,9 @@ def test_plot_tree(self, model):
result = model.plot_tree()
assert model.to_graphviz() == result.source.strip()

@pytest.mark.skipif(
sys.version_info > (3, 11), reason="Requires Python 3.11 or lower"
)
def test_to_json_binary(self, titanic_vd):
import xgboost as xgb

Expand Down Expand Up @@ -593,6 +597,9 @@ def test_to_json_binary(self, titanic_vd):
model.drop()
os.remove(path)

@pytest.mark.skipif(
sys.version_info > (3, 11), reason="Requires Python 3.11 or lower"
)
def test_to_json_multiclass(self, titanic_vd):
titanic = titanic_vd.copy()
titanic.fillna()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,14 @@ def test_regression_report_anova(

if metric_type != "":
_rel_tol, _abs_tol = calculate_tolerance(vpy_res, py_res)
print(
f"Model_class: {model_class}, Metric_name: {metric}, Metric_type: {metric_type}, rel_tol(e): {'%.e' % Decimal(_rel_tol)}, abs_tol(e): {'%.e' % Decimal(_abs_tol)}"
)
try:
print(
f"Model_class: {model_class}, Metric_name: {metric}, Metric_type: {metric_type}, rel_tol(e): {'%.e' % Decimal(_rel_tol)}, abs_tol(e): {'%.e' % Decimal(_abs_tol)}"
)
except:
print(
f"Model_class: {model_class}, Metric_name: {metric}, Metric_type: {metric_type}, rel_tol(e): {'%.e' % float(_rel_tol)}, abs_tol(e): {'%.e' % float(_abs_tol)}"
)

if py_res == 0:
assert vpy_res == pytest.approx(py_res, abs=1e-9)
Expand Down
15 changes: 12 additions & 3 deletions verticapy/tests_new/machine_learning/vertica/test_tree_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
permissions and limitations under the License.
"""
from decimal import Decimal
import sys
import os
import pandas as pd
import pytest
Expand Down Expand Up @@ -289,9 +290,14 @@ def test_regression_report_anova(

if metric_type != "":
_rel_tol, _abs_tol = calculate_tolerance(vpy_res, py_res)
print(
f"Model_class: {model_class}, Metric_name: {metric}, Metric_type: {metric_type}, rel_tol(e): {'%.e' % Decimal(_rel_tol)}, abs_tol(e): {'%.e' % Decimal(_abs_tol)}"
)
try:
print(
f"Model_class: {model_class}, Metric_name: {metric}, Metric_type: {metric_type}, rel_tol(e): {'%.e' % Decimal(_rel_tol)}, abs_tol(e): {'%.e' % Decimal(_abs_tol)}"
)
except:
print(
f"Model_class: {model_class}, Metric_name: {metric}, Metric_type: {metric_type}, rel_tol(e): {'%.e' % float(_rel_tol)}, abs_tol(e): {'%.e' % float(_abs_tol)}"
)

if py_res == 0:
assert vpy_res == pytest.approx(py_res, abs=1e-9)
Expand Down Expand Up @@ -645,6 +651,9 @@ class TestXGBModel:
test class - test class for xgb model
"""

@pytest.mark.skipif(
sys.version_info > (3, 11), reason="Requires Python 3.11 or lower"
)
def test_to_json(self, model_class, get_vpy_model, get_py_model):
"""
test function - test_to_json
Expand Down

0 comments on commit 6e1432a

Please sign in to comment.