ftcc 1.0.1

dotnet add package ftcc --version 1.0.1
NuGet\Install-Package ftcc -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ftcc" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ftcc --version 1.0.1
#r "nuget: ftcc, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ftcc as a Cake Addin
#addin nuget:?package=ftcc&version=1.0.1

// Install ftcc as a Cake Tool
#tool nuget:?package=ftcc&version=1.0.1

FTCC C#

FTCC: Fast Text Classification with Compressors dictionary.

This project is a C# implementation of the FTCC project for text classification.

The main advantage of this type of classification is that it uses ZSTD compression, which allows for compression using dictionaries that have been generated beforehand, thereby achieving significant speed improvements when classifying a text.

Available as a Nuget package.

Features

  • Set the number of compressors per class.
  • Enable parallelism during dictionary creation.
  • Determine the desired compression level.
  • Handle the serialization and deserialization of dictionaries.
  • Evaluate training files.

Performance

All tests have been done at a compression level of 3, which is the default compression level.

Compressors per class represents the number of dictionaries for each class.

Compressors per class AGNews DBpedia YahooAnswers R8 R52 Ohsumed Kinnews
CPC 1 0.837 0.892 0.417 0.908 0.818 0.426 0.754
CPC 3 0.876 0.918 0.517 0.912 0.803 0.374 0.766
CPC 5 0.881 0.925 0.551 0.896 0.776 0.370 0.756

Usage

Initialization:


string trainFile = @"C:\Users\Chus\Downloads\ag_news_train.csv";

FTCCOptions fTCCOptions = new()
{
    DictionariesPath = null,                // File path for preloaded dictionaries (ignores training file). Default: null;
    TrainFile = trainFile,                  // File path for csv train file
    ParallelismToInitialize = false,        // Use paralelism to initialize dictionaries. Default: false (if true, diccionaries will be a bit different for each execution)
    ParallelismOnTestFile = true,           // Use paralelism for each test. Default: false
    CompressionLevel = 3,                   // Compression level for dictionaries. Default: 3
    CompressorsPerClass = 3,                // Number of compressors per class. Default: 3
    TextColumn = 0,                         // Text column number in csv file. Default: 0
    LabelColumn = 1,                        // Label column number in csv file. Default: 1
    HasHeaderRecord = true,                 // Csv has header record. Deault: true
    ConsoleOutput = true,                   // Output console during file prediction. Default: true
};

FTCC fTCC = new(fTCCOptions);

Predict csv test file:


string testFile = @"C:\Users\Chus\Downloads\ag_news_test.csv";
double result = fTCC.PredictFile(testFile);
Console.WriteLine(result);

Single text prediction:

string text = "Socialites unite dolphin groups Dolphin groups, or \"pods\", rely on socialites to keep them from collapsing, scientists claim.";
var prediction = fTCC.Predict(text);
Console.WriteLine(prediction);

Dictionary serialisation:

Serializing the dictionaries allows for preloading the FTCC objects later on, so that it doesn't need to create the dictionaries, but instead reads them from file. This way, it allows for immediate text classification.


string dictionariesPath = @"C:\Users\Chus\Downloads\dictionaries.ftcc";
fTCC.SerializeDiccionaries(dictionariesPath);

To create the FTCC object with the serialized dictionaries:


FTCCOptions fTCCOptions = new()
{
    DictionariesPath = dictionariesPath
};

FTCC fTCC = new(fTCCOptions);

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 146 8/28/2023
1.0.0 127 8/20/2023