AI::Ca...iSquare(3pm)
π AI::Ca...iSquare(3pm) β User Contributed Perl Documentation π
okay bestie, buckle up, because we're about to talk about ChiSquare Feature Selection and honestly? it's giving math but make it fashion. this page lives in the User Contributed Perl Documentation manual, and it's the whole vibe for AI::Categorizer::FeatureSelector::ChiSquare. β¨
πΈ NAME πΈ
AI::Categorizer::FeatureSelector::ChiSquare β the ChiSquare Feature Selection class. that's it, that's the name, slay. π
π SYNOPSIS π
here's how you actually use this thing, no cap:
# the recommended way to use this class is to let the KnowledgeSet
# instanciate it
use AI::Categorizer::KnowledgeSetSMART;
my $ksetCHI = new AI::Categorizer::KnowledgeSetSMART(
tfidf_notation =>'Categorizer',
feature_selection=>'chi_square', ...other parameters...);
# however it is also possible to pass an instance to the KnowledgeSet
use AI::Categorizer::KnowledgeSet;
use AI::Categorizer::FeatureSelector::ChiSquare;
my $ksetCHI = new AI::Categorizer::KnowledgeSet(
feature_selector => new ChiSquare(features_kept=>2000,verbose=>1),
...other parameters...
);
so like, the recommended way is to just let the KnowledgeSet instanciate it for you β you hand over feature_selection=>'chi_square' and vibe. however, it is also possible to pass an instance directly to the KnowledgeSet yourself if you're feeling main character about it. both routes are valid, iykyk. π
π¦ DESCRIPTION π¦
Feature selection with the ChiSquare function. literally what it says on the tin, bestie.
here's the formula, and yes it's the moment, look at her:
Chi-Square(t,ci) = (N.(AD-CB)^2)
-----------------------
(A+C).(B+D).(A+B).(C+D)
where t = term
ci = category i
N = number of documents in the collection
A = number of times where t and c co-occur
B = " " " t occurs without c
C = " " " c occurs without t
D = " " " neither c nor t occur
so t is the term, ci is category i, N is the number of documents in the collection, and then A, B, C and D are the four little counters of who-co-occurs-with-what. A is the number of times where t and c co-occur, B is the number of times t occurs without c, C is the number of times c occurs without t, and D is the number of times neither c nor t occur. iconic quartet honestly. π«Ά
for more details, see : Yiming Yang, Jan O. Pedersen, A Comparative Study on Feature Selection in Text Categorization, in Proceedings of ICML-97, 14th International Conference on Machine Learning, 1997. (available on citeseer.nj.nec.com) β go read the source material, it's the blueprint. π
π METHODS π
bestieβ¦ this section is literally empty. no methods listed, no bullets, nothing. the heading is there and then the next section starts. we respect the void. π
π AUTHOR π
Francois Paradis, paradifr@iro.umontreal.ca, with inspiration from Ken Williams' AI::Categorizer code. giving credit where credit is due, as you should. π
okay that's the whole page, and per the footer tea: this is perl v5.42.0, dated 2025-07-25, filed under AI::Ca...iSquare(3pm). go forth and select your features, bestie, you're gonna ate. πβ¨π¦πΈπ«Άπ
π¦ where this page comes from
- fedora 43: perl-AI-Categorizer 0.09-38.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms