semvec/pypi-packages huggingface dataset:
simple-kNN 1.1.6
Simple kNN algorithm with k-Fold Cross Validation
Requires Python: >=3.6

# simple-kNN

[![pypi](https://img.shields.io/pypi/v/simple-kNN?color=red&label=PyPI&style=for-the-badge)](https://pypi.python.org/pypi/simple-kNN)
[![ci](https://img.shields.io/github/workflow/status/chaitanyakasaraneni/simple-kNN/Continuous%20Integration?&label=Continuous%20Integration&logo=GitHub&style=for-the-badge)](https://pypi.python.org/pypi/simple-kNN)

This repository is for Continuous Integration of my simple k-Nearest Neighbors (kNN) algorithm to pypi package.

For notebook version please visit [this repository](https://github.com/chaitanyakasaraneni/knnFromScratch)

#### *k*-Nearest Neighbors
*k*-Nearest Neighbors, kNN for short, is a very simple but powerful technique used for making predictions. The principle behind kNN is to use **“most similar historical examples to the new data.”**

#### *k*-Nearest Neighbors in 4 easy steps
 - Choose a value for *k*
 - Find the distance of the new point to each record of training data
 - Get the k-Nearest Neighbors
 - Making Predictions
   - For classification problem, the new data point belongs to the class that most of the neighbors belong to. 
   - For regression problem, the prediction can be average or weighted average of the label of k-Nearest Neighbors

Finally, we evaluate the model using *k*-Fold Cross Validation technique

#### *k*-Fold Cross Validation
This technique involves randomly dividing the dataset into k-groups or folds of approximately equal size. The first fold is kept for testing and the model is trained on remaining k-1 folds.

## Installation
```
pip install simple-kNN
```
## Usage

```
from simple_kNN.distanceMetrics import distanceMetrics
from simple_kNN.kFoldCV import kFoldCV
from simple_kNN.kNNClassifier import kNNClassifier
```

#### References
- My [medium article on building kNN from scratch](https://link.medium.com/BV27Pox3qab)
- More info on Cross Validation can be seen [here](https://medium.com/datadriveninvestor/k-fold-and-other-cross-validation-techniques-6c03a2563f1e)
- [kNN](https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html)
- [kFold Cross Validation](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.KFold.html)
cspb 1.0.0
CSPB driver package
Requires Python: >=2.7
Keywords: cluster system power cspb driver raspberry pi

# cspb

The cspb package contains a python driver class for communications with the Cluster System Power Board (cspb) hardware.

## Introduction

The cspb package contains a wrapper driver around the smbus package. It enables easy communication with the cluster system power board hardware via an i2c bus.

Currently supported methods are:

- set_power

- shutdown

- signal_shutdown

- read_register

- write_register

- set_register_number

- send_command

## Dependencies

This driver depends on the [smbus ]([smbus · PyPI](https://pypi.org/project/smbus/))package.

## CSPB code examples

### Example 1: Display the current power state

```
from cspb.CSPB import CSPB

i2c_bus_number = 1
i2c_address = 21
cspb = CSPB(i2c_bus_number, i2c_address)
power_state = cspb.read_register(cspb.PWR_STTS_REGSTR_ADDR)
print(power_state)
```

### Example 2: Request shutdown of all power slots

```
from cspb.CSPB import CSPB

i2c_bus_number = 1
i2c_address = 21
cspb = CSPB(i2c_bus_number, i2c_address)
cspb.shutdown(#ff)
```

## Installation Instructions

cspb is a pure Python and requires no compilation. Install as follows:

```
pip install cspb
```