Реализация алгоритма cart python

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

CART Algorithm — A Decision Tree for Numerical and Categorical Data that can Handle Missing Values and Pruning Methods

Valdecy/CART

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

CART (Classification And Regression Trees)

CART Algorithm uses the Gini Index measure to analyse numerical data. Categorical data is handled by a one-hot encoding transformation, creating in this way, a dummy variable for each category. This guarantees that the binary splits will always occur. Finally, the function returns: 1) The decision tree rules. 2) The total number of rules.

  • Xdata = Dataset Attributes
  • ydata = Dataset Target
  • cat_missing = «none», «missing», «most», «remove» or «probability». If «none» is selected then nothing will be done if there are missing categorical values. If «missing» is selected then the missing categorical values will be replaced by a new category called Unkown. If «most» is selected then the categorical missing values will be replaced by the most popular category of the attribute. If «remove» is selected then the observation with missing categorical values will be deleted from the dataset. If «probability» is selected then the categorical missing values will be randomly replaced by a category based on the category distribution of the attribute.
  • num_missing = «none», «mean», «median», «remove» or «probability». If «none» is selected then nothing will be done if there are missing numerical values. If «mean» is selected then the missing numerical values will be replaced by the attribute mean. If «median» is selected then the numerical missing values will be replaced by the attribute median. If «most» is selected then the numerical missing values will be replaced by the most popular value of the attribute. If «remove» is selected then the observation with missing numerical values will be deleted from the dataset. If «probability» is selected then the numerical missing values will be randomly replaced by a value based on the numerical distribution of the attribute.
  • pre_pruning = «none», «chi_2», or «min». If «none» is selected then no pruning is performed. If «chi_2» is selected then a pre-pruning method based on a Chi Squared test is performed, if the table is in the 2×2 format and has less than 10,000 examples then a Fisher Exact test is performed instead. if «min» is selected then a node must have a minimum quantity of data examples to avoid pruning.
  • chi_lim = 0.1. Chi Squared limit (p-value) to prune a node. Only relevant if pre_pruning = «chi_2».
  • min_lim = 5. Minimum quantity of data examples that a node should have to avoid pruning. Values lower than this limit makes a node to be pruned. Only relevant if pre_pruning = «min».
  • Finnaly a prediction function — prediction_dt_cart( ) — is also included.

About

CART Algorithm — A Decision Tree for Numerical and Categorical Data that can Handle Missing Values and Pruning Methods

Источник

Читайте также:  Php send mail using localhost
Оцените статью