Skip to main content

A mini implementation of Scikit-Learn with custom models and metrics

Project description

Here's a comprehensive README file for your project:

# CC-Mini-Scikit-Learn

## Overview

CC-Mini-Scikit-Learn is a mini implementation of Scikit-Learn that provides custom models and metrics for machine learning tasks. This package includes various classification, regression, ensemble, and preprocessing algorithms, along with utilities and custom metrics for model evaluation.

## Features

- Custom implementation of various machine learning algorithms
- Custom metrics for model evaluation
- Grid search and cross-validation tools
- Preprocessing tools for data transformation
- Published as a PyPI package for easy installation and use

## Table of Contents

1. [Installation](#installation)
2. [Usage](#usage)
3. [Project Structure](#project-structure)
4. [Implemented Modules](#implemented-modules)
5. [Examples](#examples)
6. [Contributing](#contributing)
7. [License](#license)

## Installation

You can install CC-Mini-Scikit-Learn via pip:

```bash
pip install cc-mini-scikit-learn

Usage

Here is an example of how to use CC-Mini-Scikit-Learn:

from cc_mini_scikit_learn.supervised_learning.classification import KNNClassifier
from cc_mini_scikit_learn.metrics import Accuracy
import numpy as np

# Sample data
X_train = np.array([[1, 2], [2, 3], [3, 4], [4, 5]])
y_train = np.array([0, 1, 0, 1])
X_test = np.array([[1, 2], [2, 3]])

# Initialize and train the classifier
knn = KNNClassifier(n_neighbors=3)
knn.fit(X_train, y_train)

# Make predictions
predictions = knn.predict(X_test)

# Evaluate the model
accuracy = Accuracy()
print("Accuracy:", accuracy(y_train, predictions))

## Implemented Modules

### Ensemble
- **AdaBoost:** Implementation of the AdaBoost algorithm.
- **GradientBoostingClassifier:** Implementation of Gradient Boosting for classification.
- **RandomForestClassifier:** Implementation of Random Forest for classification.
- **RandomForestRegressor:** Implementation of Random Forest for regression.

### Metrics
- **Accuracy:** Compute the accuracy of predictions.
- **ConfusionMatrix:** Compute the confusion matrix for classification results.
- **F1Score:** Compute the F1 score for classification results.
- **MeanAbsoluteError:** Compute the mean absolute error for regression results.
- **MeanSquaredError:** Compute the mean squared error for regression results.
- **Precision:** Compute the precision score for classification results.
- **Recall:** Compute the recall score for classification results.
- **RootMeanSquaredError:** Compute the root mean squared error for regression results.

### Model Selection
- **GridSearchCV:** Perform grid search cross-validation.
- **KFold:** Implement k-fold cross-validation.
- **ParameterGrid:** Generate parameter grid for grid search.
- **train_test_split:** Split data into train and test sets.

### Neural Networks
- **MLP:** Multi-Layer Perceptron for classification tasks.
- **MLPRegressor:** Multi-Layer Perceptron for regression tasks.
- **Perceptron:** Basic Perceptron classifier.

### Preprocessing
- **LabelEncoder:** Encode target labels with value between 0 and n_classes-1.
- **MinMaxScaler:** Scale features to a given range, usually [0, 1].
- **OneHotEncoder:** Encode categorical integer features as a one-hot numeric array.
- **SimpleImputer:** Impute missing values using a specified strategy.
- **StandardScaler:** Standardize features by removing the mean and scaling to unit variance.

### Supervised Learning
- **BaseEstimator:** Base class for all estimators.
- **classification**
  - **DecisionTreeClassifier:** Decision Tree for classification tasks.
  - **KNNClassifier:** k-Nearest Neighbors classifier.
  - **LogisticRegression:** Logistic Regression classifier.
  - **NaiveBayes:** Naive Bayes classifier.
  - **SVM:** Support Vector Machine classifier.
- **regression**
  - **DecisionTreeRegressor:** Decision Tree for regression tasks.

### Utilities
- Placeholder for utility functions and classes.

## Examples

Refer to the `tests` directory for examples of how to use the various models and metrics provided in this package.

Project details


Download files

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

Source Distribution

cc-mini-scikit-learn-1.0.1.tar.gz (25.0 kB view details)

Uploaded Source

File details

Details for the file cc-mini-scikit-learn-1.0.1.tar.gz.

File metadata

  • Download URL: cc-mini-scikit-learn-1.0.1.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.7

File hashes

Hashes for cc-mini-scikit-learn-1.0.1.tar.gz
Algorithm Hash digest
SHA256 264a9582294aa6933d10871071465d7c50588940abba77b90f931e2bfe85ccec
MD5 8201f6b5e7c9ea61c788e00c13904f30
BLAKE2b-256 b841889dd35a404c44c7cc5691cff408addc630e2cf173f33cf8485c029bea6e

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