SlideShare a Scribd company logo
klassify
Text classification with Redis
Fatih Erikli
Software Developer
@Adphorus
fatiherikli@gmail.com
http://fatiherikli.com
Text Classification
The task is to assign a document to one or
more classes or categories.
• Spam filters
• Web page classification
• News and and topic categorization
• Sentiment Analysis
Use cases
• Neural Networks
• K-nearest neighbour algorithms
• Decision Trees
• Naive Bayes Classification
Techniques
Training
Just count the words under a label.
Politics
democrat 4
socialism 20
democrat 30
communism 20
politician 10
holacaust 20
Drugs
smoke 30
weed 22
lsd 34
heroin 54
cannabis 23
marijuana 52
Classification
Stem, singularize and eliminate given text
Marijuana should be legalized
nationally in the United States
just as it is already in
Colorado.
Classification
Calculate scores for each labels
Marijuana should be legalized
nationally in the United States
just as it is already in
Colorado.
drugs: 4 drugs: 2
politics: 3
Drugs = 4 + 2 = 6 / TotalWordCountOfDrugs
Politics = 3 / TotalWordCountOfPolitics
Redis Implementation
SADD labels Politics
SADD labels Drugs
SADD labels Game
SADD labels Programming
Initial labels
initial labels on a Set which is called `labels`
HINCRBY Programming Brainfuck 2
`awesome` and `is` should not be
trained. they are fuzzy words for
training logic.
Querying for training
“Brainfuck! Brainfuck is awesome” as Programming
HVALS Programming
# 3 3 2 3 5


HGET Programming Brainfuck
# 5
Queries for classification
A protoype:
http://github.com/fatiherikli/klassify


HTTP POST :8888/train


{
‘text’: ‘Brainfuck is awesome’,

‘label’: ‘Programming’
}
Training




HTTP POST :8888/classify


{
‘text’: ‘Brainfuck is awesome’
}
Classification


{
"label": "Programming",
"scores": {
"Aliens": 1.428,
"Animals": 2.380,
"Society": 6.4935,
"Technology": 9.523
}
}
responserequest


{
"label": "Programming",
"scores": {
"Aliens": 1.4285714285714287e-05,
"Animals": 2.380952380952381e-06,
"Society": 6.493506493506494e-07,
"Technology": 9.523809523809525e-07
}
}
Response
DEMO

More Related Content

PDF
Agent-based Models
PDF
Celery
PDF
PDF
Django Introduction
PDF
Arguman
PDF
Django ORM Optimizasyonu
PDF
Lettuce ile Behaviour Driven Development
PDF
Processing - Programcılar için eskiz defteri
Agent-based Models
Celery
Django Introduction
Arguman
Django ORM Optimizasyonu
Lettuce ile Behaviour Driven Development
Processing - Programcılar için eskiz defteri

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
Machine Learning_overview_presentation.pptx
PPTX
A Presentation on Artificial Intelligence
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
August Patch Tuesday
PDF
Empathic Computing: Creating Shared Understanding
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
1. Introduction to Computer Programming.pptx
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Mushroom cultivation and it's methods.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
Machine Learning_overview_presentation.pptx
A Presentation on Artificial Intelligence
cloud_computing_Infrastucture_as_cloud_p
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
August Patch Tuesday
Empathic Computing: Creating Shared Understanding
Unlocking AI with Model Context Protocol (MCP)
Spectral efficient network and resource selection model in 5G networks
Advanced methodologies resolving dimensionality complications for autism neur...
1. Introduction to Computer Programming.pptx
OMC Textile Division Presentation 2021.pptx
Mushroom cultivation and it's methods.pdf
Machine learning based COVID-19 study performance prediction
Network Security Unit 5.pdf for BCA BBA.
Digital-Transformation-Roadmap-for-Companies.pptx
A comparative study of natural language inference in Swahili using monolingua...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Ad
Ad

Klassify: Text Classification with Redis