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.3.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.3.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sk_linearregression-0.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 f607f1894b935b85b8d1401221d0fd28062e784bea7e3a5732b2e41b5857bb8b
MD5 0ecd4cd95a053dcd33fd19cf5dbc9636
BLAKE2b-256 f1f27813b3889d5c5cf8c6eb5c4a1569e417de54d256237e20585570f59d130a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sk_linearregression-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 038e75e2b98bfb6b78eefc3030009c3b23460ef8eca2c2891012e344c6e6a412
MD5 299223bbec8d6825c6f449a51b057757
BLAKE2b-256 7b03addf38f14269800ccb728068c144a9db2ca434a5fdcb3b8949e998738b59

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