Binclassify is a library that makes it easy to classify into groups. The main idea of the library is to classify as many groups as possible using the minimum number of questions.
Project description
BinClassify
Binclassify is a library that makes it easy to classify into groups. The main idea of the library is to classify as many groups as possible using the minimum number of questions.The library can be useful when we need to divide users by interests. I also apologize for my crooked English translation. Author's website: https://tatem.pythonanywhere.com/
For example, we need to divide users into 10 groups. And in order for us to do this, we just need to ask 4 questions. And for 300 groups there are only 9 questions. The questions should be binary. For example: yes and no. We will be able to find out the number of questions using the method from our library. A good example is my soul color(RGB) detection test - Color Soul https://tatem.pythonanywhere.com/project/colorpeople/
A simple example:
Let's find out how many questions we need:
# Import library
from BinClassify import BinClassify
# Creating a class
binclass = BinClassify()
"""
CoutQustion accepts the number of groups you want to get.
The number should be:
1. The whole
2. More than 1
If the transfer is successful, it returns the number of responses that you must pass to the Answer method.
"""
print(binclass.CoutQustion(10))
# Outputs: 4
Then suppose we conduct a survey on our website:
- Do you have many friends?
- Yes (save as 1)
- No (save as 0)
- Do you like busy places?
- Yes (save as 1)
- No (save as 0)
- Do you see your friends often?
- Yes (save as 1)
- No (save as 0)
- Are you popular with people?
- Yes (save as 1)
- No (save as 0)
Classification by groups:
from BinClassify import BinClassify
# Sample data from the above test
data = [1, 0, 1, 0]
binclass = BinClassify()
binclass.CoutQustion(10) # 4
"""
The Answer method. Accepts an array with the following criteria:
1. The length of the array must be equal to the number returned by the CoutQustion method.
2. Array elements must be binary (1 or 0).
"""
print(binclass.Answer(data))
# Outputs: 6
# This means that my answer puts me in group 6.
# Starts from 1.
# Let's try a few more times:
print(binclass.Answer([0, 0, 0, 0])) # 1
print(binclass.Answer([1, 1, 1, 1])) # 10
print(binclass.Answer([1, 1, 1, 0])) # 9
Find out how many groups can be divided into by the number of questions
# Import library
from BinClassify import BinClassify
# Creating a class
binclass = BinClassify()
"""
CoutGroups accepts the number of questions. Returns an array with a range of the number of groups.
The first element is the minimum number of groups for such a number of questions, the second is the maximum.
The minimum transmitted number is 1.
"""
print(binclass.CoutGroups(4))
# Outputs: [9, 16]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file BinClassify-1.1.1.tar.gz
.
File metadata
- Download URL: BinClassify-1.1.1.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea6b5e7c359c346b9b4ca83b3eb218627255f52dfb6e863137a07b609ade5ca2 |
|
MD5 | 464cbf93c8d8c78fb7416acd61802e08 |
|
BLAKE2b-256 | 48a893c223641b49ae18e02dedca21bfcaa7c8ae3d85a18f82645fbd0b03006b |