Skip to main content

KNN Regression Algorithm.

Anyone of you can use this library to do KNN Regression in Google Colab with a all numeric valued dataset. Github Open Source

Existing methods

  • KnnRegression(path,TargetAtLast) - It takes two parameter first one is a string of the csv file path and the second one is a boolean to specify, the position of the target coloum it target is at last then the value will be True.Returns a object of KnnClassification class
  • loadToList() - It returns the loaded dataset as a python list.
  • list_split(DataList) - It takes a single parameter the dataset list from the which is the return value of previous method,and it return a tuple containing three list Splited into Train(70%), Validation(15%), Test(15%).
  • knn(x_list,y_list,k) - It takes three parameter first one is either validation list or test list, second one is train list and the third one is value of k, It returns the root mean square error.

using process

1st need to add the library

pip install KnnRegressionRobGin

2nd You must need to mount your google drive if you want to load csv from your drive

from google.colab import drive
drive.mount('/content/gdrive')
# You must need to run this code script at first to mount your drive with colab 

Mount Drive with colab

3rd you need to copy the csv file path for further use

4th import KnnRegressionRobGin and set the file path and target position

import KnnRegressionRobGin as KNN
KNN = KNN.KnnRegression("/content/sample_data/file_name.csv",True) #set path

5th load the dataset into a list and split it

DataList = KNN.loadToList() #Loading the list of given dataset
Train,Validation,Test = KNN.list_split(DataList) # Spliting dataset into three

Run the knn to show the accuracy of the dataset

RMSE = KNN.knn(Validation,Train,5) #Put Validation list to train or put test list to test.(here k=5)
print(RMSE)

N.B: Its not neccessary to split your dataset using given method(fix size) you could split your dataset by your own custom size as well :)

Metadata

Release files for KnnRegressionRobGin 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for KnnRegressionRobGin 1.0.0
File Size Uploaded
KnnRegressionRobGin-1.0.0.tar.gz 2.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for KnnRegressionRobGin 1.0.0
File Interpreter ABI Platform
KnnRegressionRobGin-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.8 kB

Release files / KnnRegressionRobGin-1.0.0.tar.gz

Download URL KnnRegressionRobGin-1.0.0.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4d399932440b85bd1a53b999d16107f904587930886baa204ab89587bed5afc0
BLAKE2b-256 checksum
How to use checksums
2162671252ec26c58bf197a82f14573e1868dbedfa64b3a11b40579a87e39107
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

Release files / KnnRegressionRobGin-1.0.0-py3-none-any.whl

Download URL KnnRegressionRobGin-1.0.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6ed48de4ea4357d2fd8c532885b8f76ca351935f7d8f1855575fcae4e0b1097
BLAKE2b-256 checksum
How to use checksums
016af63fbd2f77250475a9612c51352e469f0dceb7933ee1d454c06599915e77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page