Skip to main content

My own Linear Regression under the sk.* namespace

Project description

sk.linearregression

🚀 My first Python package on PyPI!

This package provides a simple implementation of Linear Regression along with helpful preprocessing utilities such as handling missing values, scaling data, and splitting into train/test sets.


✨ Features

  • LinearRegression – Simple regression model
  • HandleMissingValue – Fill or drop missing values
  • MinMaxScaler – Normalize features to a given range
  • TrainTestSplit – Split your dataset into training and testing sets

📦 Installation

Install directly from PyPI:

pip install sk.linearregression




# Sample Uses
from sk.linearregression import LinearRegression, HandleMissingValue, TrainTestSplit, MinMaxScaler
import pandas as pd
import matplotlib.pyplot as plt

def main():
    df = pd.read_csv("train.csv")

    Y = df["SalePrice"]
    X = df.drop(columns=["SalePrice", "Id"])
    X = HandleMissingValue(X)

    X_train, X_test, Y_train, Y_test = TrainTestSplit(X, Y)

    X_train = MinMaxScaler(X_train)
    X_test = MinMaxScaler(X_test)
    
    obj = LinearRegression(X_train, Y_train)
    w, b = obj.regression()
    y_pred = obj.predict(X_test.values.astype(float), w, b)

    plt.figure(figsize=(10, 5))
    plt.plot(Y_test.values[:100], label='Actual', marker='o')  # Use .values if it's a Pandas Series
    plt.plot(y_pred[:100], label='Predicted', marker='x')
    plt.title("Comparison of Actual vs Predicted (First 100 Samples)")
    plt.xlabel("Sample Index")
    plt.ylabel("Target Value")
    plt.legend()
    plt.show()

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

sk_linearregression-0.4.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sk_linearregression-0.4.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file sk_linearregression-0.4.0.tar.gz.

File metadata

  • Download URL: sk_linearregression-0.4.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.12

File hashes

Hashes for sk_linearregression-0.4.0.tar.gz
Algorithm Hash digest
SHA256 50c66b7a7f341149446a8ebce9ccbcc78ffb06ae34ed3fcbe418f32c8f81c460
MD5 278d8aa01632e98175cef89b021a3269
BLAKE2b-256 84a146dee9350a8e20f0b728d1970832e66c613ec9f677b3a4700c022da256f1

See more details on using hashes here.

File details

Details for the file sk_linearregression-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sk_linearregression-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7497bf40569f59a2a67e40ed096814644049b6e8050b9161581c77ef3e2f7430
MD5 8f1812be9c136d79b7f78ea7072dd95e
BLAKE2b-256 41a4863dcd33d23595cb40c11a03b5dee1cf39eb1cb8835e004edfced08a3fcd

See more details on using hashes here.

Supported by

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