GoBinClassify - A library that makes it easy to classify into groups

GoBinClassify


GoBinClassify 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

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

A simple example:

Installation

go get github.com/Daniil-7/GoBinClassify

Let's find out how many questions we need:

package main

// Import library
import (
 "github.com/Daniil-7/GoBinClassify"
 "fmt"
 "log"
)


/*
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.
*/

func main() {
  qcout, err := GoBinClassify.CoutQustion(10)
  
  if err != nil {
    log.Fatal(err)
  }
  
  fmt.Println(qcout)
  // Outputs: 4
}

Then suppose we conduct a survey on our website:

  1. Do you have many friends?
  1. Yes (save as 1)
  2. No (save as 0)
  1. Do you like busy places?
  1. Yes (save as 1)
  2. No (save as 0)
  1. Do you see your friends often?
  1. Yes (save as 1)
  2. No (save as 0)
  1. Are you popular with people?
  1. Yes (save as 1)
  2. No (save as 0)

Classification by groups:

package main

// Import library
import (
  "github.com/Daniil-7/GoBinClassify"
  "fmt"
  "log"
)

/*
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).
*/
func main() {
  ans1, err := GoBinClassify.Answer(10, []int{1, 0, 1, 0})
  if err != nil {
    log.Fatal(err)
  }
  fmt.Println(ans1)
  // Outputs: 6
  // This means that my answer puts me in group 6.
  // Starts from 1.
  // Let's try a few more times:
  
  ans2, err := GoBinClassify.Answer(10, []int{0, 0, 0, 0})
  if err != nil {
    log.Fatal(err)
  }
  fmt.Println(ans2) // 0
  
  ans3, err := GoBinClassify.Answer(10, []int{1, 1, 1, 1})
  if err != nil {
    log.Fatal(err)
  }
  fmt.Println(ans3) // 10
  
  ans4, err := GoBinClassify.Answer(10, []int{1, 1, 1, 0})
  if err != nil {
    log.Fatal(err)
  }
  fmt.Println(ans4) // 9
}

Find out how many groups can be divided into by the number of questions

package main

// Import library
import (
  "github.com/Daniil-7/GoBinClassify"
  "fmt"
  "log"
)

/*
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.
*/

func main() {
  gcout, err := GoBinClassify.CoutGroups(4)
  if err != nil {
    log.Fatal(err)
  }
  fmt.Println(gcout)
  // Outputs: [9, 16]
}
Owner
Hi, my name is Daniil. I am a Russian developer writing in the languages: Python, JavaScript, Go.
null
Similar Resources

LTF is a minimal, transparent Terraform wrapper. It makes Terraform projects easier to work with.

LTF Status: alpha LTF is a minimal, transparent Terraform wrapper. It makes Terraform projects easier to work with. In standard Terraform projects, th

Nov 19, 2022

A Go script that makes your GitHub contribution activity panel look awesome! Display a message !

A Go script that makes your GitHub contribution activity panel look awesome! Display a message !

GitHub contributions generator A script written in Go, which goal is to make your GitHub contributions graph the way you want it to be. The goal of th

Jan 6, 2023

library to make building things with bitclout easy

cloutcli library to make building things with bitclout easy quick start demo cmd $ ./clout demo clout demo visualizegraph # make clout.gv graph fi

Jul 27, 2022

KubeOrbit is an open-source abstraction layer library that turns easy apps testing&debuging on Kubernetes in a new way

KubeOrbit is an open-source abstraction layer library that turns easy apps testing&debuging on Kubernetes in a new way

KubeOrbit is an open-source abstraction layer library that turns easy apps testing&debuging on Kubernetes in a new way

Jan 6, 2023

k8s-image-swapper Mirror images into your own registry and swap image references automatically.

k8s-image-swapper Mirror images into your own registry and swap image references automatically.

k8s-image-swapper Mirror images into your own registry and swap image references automatically. k8s-image-swapper is a mutating webhook for Kubernetes

Dec 27, 2022

Translate Prometheus Alerts into Kubernetes pod readiness

prometheus-alert-readiness Translates firing Prometheus alerts into a Kubernetes readiness path. Why? By running this container in a singleton deploym

Oct 31, 2022

Vilicus is an open source tool that orchestrates security scans of container images(docker/oci) and centralizes all results into a database for further analysis and metrics.

Vilicus is an open source tool that orchestrates security scans of container images(docker/oci) and centralizes all results into a database for further analysis and metrics.

Vilicus Table of Contents Overview How does it work? Architecture Development Run deployment manually Usage Example of analysis Overview Vilicus is an

Dec 6, 2022

At LinkedIn, we are using this curriculum for onboarding our entry-level talents into the SRE role.

At LinkedIn, we are using this curriculum for onboarding our entry-level talents into the SRE role.

School of SRE In early 2019, we started visiting campuses across India to recruit the best and brightest minds to ensure LinkedIn, and all the service

Dec 30, 2022
The OCI Service Operator for Kubernetes (OSOK) makes it easy to connect and manage OCI services from a cloud native application running in a Kubernetes environment.

OCI Service Operator for Kubernetes Introduction The OCI Service Operator for Kubernetes (OSOK) makes it easy to create, manage, and connect to Oracle

Sep 27, 2022
The NiFiKop NiFi Kubernetes operator makes it easy to run Apache NiFi on Kubernetes.
The NiFiKop NiFi Kubernetes operator makes it easy to run Apache NiFi on Kubernetes.

The NiFiKop NiFi Kubernetes operator makes it easy to run Apache NiFi on Kubernetes. Apache NiFI is a free, open-source solution that support powerful and scalable directed graphs of data routing, transformation, and system mediation logic.

Dec 26, 2022
Aws asg updater - Update AMIs within AWS Auto Scaling groups automatically.

AWS Auto Scaling Groups Updater AWS Auto Scaling group is a great way of managing Amazon EC2 instances. AWS Auto Scaling group watches the correspondi

Oct 7, 2022
Create AWS Auto Scaling groups from running instances or AMIs automatically.

AWS Auto Scaling Groups Builder AWS Auto Scaling group is a great way of managing Amazon EC2 instances. AWS Auto Scaling group watches the correspondi

Oct 7, 2022
Rotate is a tool for rotating out AWS Auto-Scaling Groups within a k8s cluster

k8s-r8 rotate is a tool for rotating out AWS Auto-Scaling Groups within a k8s cluster. It was developed to make upgrading AMIs as a one command experi

Mar 27, 2022
⚙️ Operating Account Operators (OAO) is a Golang tool to interact with the LDAP protocol to manage account groups, roles, ACLs/ACEs, etc...
⚙️ Operating Account Operators (OAO) is a Golang tool to interact with the LDAP protocol to manage account groups, roles, ACLs/ACEs, etc...

⚙️ OAO (Operating Account Operators) ⚙️ Operating Account Operators (OAO) is a Golang tool to interact with the LDAP protocol to manage account groups

May 11, 2023
moreHandlers is a library which makes possible the use of multiple handlers for the MCBE server software

moreHandlers moreHandlers is a library which makes possible the use of multiple handlers for the MCBE server software https://github.com/df-mc/dragonf

Aug 4, 2022
Hexagonal architecture paradigms, such as dividing adapters into primary (driver) and secondary (driven)Hexagonal architecture paradigms, such as dividing adapters into primary (driver) and secondary (driven)

authorizer Architecture In this project, I tried to apply hexagonal architecture paradigms, such as dividing adapters into primary (driver) and second

Dec 7, 2021
Kusk makes your OpenAPI definition the source of truth for API resources in your cluster
Kusk makes your OpenAPI definition the source of truth for API resources in your cluster

Kusk - use OpenAPI to configure Kubernetes What is Kusk? Developers deploying their REST APIs in Kubernetes shouldn't have to worry about managing res

Dec 16, 2022
A proof-of-concept project that makes accessible buildkitd daemon from macOS

buildkit-machine buildkit-machine allows you to make buildkitd daemon accessible in your macOS environment. To do so, it uses lima, which is a Linux s

Dec 21, 2022