Skip to main content

Build decision trees and random forests for classification and regression.

Project description

Description

Build random forests for classification and regression problems. The same program is available on CRAN for R users.

Installation

For Python:

python3 -m pip install brif

For R:

install.packages('brif')

Examples

import brif
import pandas as pd

# Create a brif object with default settings
bf = brif.brif()  

# Display the current parameter values. Parameter meanings are documented in the 'brif' package in R. 
bf.get_param()  

# To change certain parameter values, e.g.:
bf.set_param({'ntrees':100, 'nthreads':2})

# Or simply:
bf.ntrees = 200

# Load input data frame. Data must be a pandas data frame with appropriate headers.
# Header text and factor variable values must not contain any white space.
df = pd.read_csv("auto.csv")

# Train the model
bf.fit(df, 'origin')  # specify the target column name

# Or equivalently
bf.fit(df, 7)  # specify the target column index

# Make predictions 
# The target variable column must be excluded, and all other columns should appear in the same order as in training
# Here, predict the first 10 rows of df
pred_labels = bf.predict(df.iloc[0:10, 0:7], type='class')  # return a list containing the predicted class labels
pred_scores = bf.predict(df.iloc[0:10, 0:7], type='score')  # return a data frame containing predicted probabilities by class

# Note: for a regression problem (i.e., when the response variable is numeric type), the predict function will always return a list containing the predicted values

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

brif-1.2.0-cp310-cp310-win_amd64.whl (30.8 kB view details)

Uploaded CPython 3.10 Windows x86-64

brif-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl (40.3 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file brif-1.2.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: brif-1.2.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 30.8 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for brif-1.2.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f476079f484165d6ee3d832b1f036b102aedcb250bb97796aaff3e61d88dca63
MD5 e45f4c2af57bc16a3b2a51f970ce26fe
BLAKE2b-256 4f3e0af81d3d9f3932f3bb53707289165d95740c24b62c2bbfc35ddc9e399b1e

See more details on using hashes here.

File details

Details for the file brif-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for brif-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 342e4cfe4bdc10b820a3aae083f729dd9270c8bcc18d8ba8bd200a65bddaba49
MD5 2497a8be2dcbf6db01bd17ad5ec4cd41
BLAKE2b-256 ee64aab22a3173da5ec61c83919e348c4a559abb6a41847820ac47dc221d6408

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page