ArffTools 1.1.3

Install-Package ArffTools -Version 1.1.3
dotnet add package ArffTools --version 1.1.3
<PackageReference Include="ArffTools" Version="1.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ArffTools --version 1.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ArffTools, 1.1.3"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ArffTools as a Cake Addin
#addin nuget:?package=ArffTools&version=1.1.3

// Install ArffTools as a Cake Tool
#tool nuget:?package=ArffTools&version=1.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

ArffTools

.NET library for reading and writing Weka attribute-relation file format (ARFF) files

NuGet license

Features

  • Read and write ARFF files
  • Supports relational attributes
  • Supports sparse instances
  • Supports instance weights
  • Proper quoting and escaping of special characters

Usage

Reading ARFF files:

using (ArffReader arffReader = new ArffReader("glass.arff"))
{
    ArffHeader header = arffReader.ReadHeader();    
    object[] instance;    
    while ((instance = arffReader.ReadInstance()) != null)
    {
        // process instance
    }    
}

Reading all instances at a time:

object[][] instances = arffReader.ReadAllInstances();

Writing ARFF files:

using (ArffWriter arffWriter = new ArffWriter("iris.arff"))
{
    arffWriter.WriteRelationName("iris");
    arffWriter.WriteAttribute(new ArffAttribute("sepallength", ArffAttributeType.Numeric));
    arffWriter.WriteAttribute(new ArffAttribute("sepalwidth", ArffAttributeType.Numeric));
    arffWriter.WriteAttribute(new ArffAttribute("petallength", ArffAttributeType.Numeric));
    arffWriter.WriteAttribute(new ArffAttribute("petalwidth", ArffAttributeType.Numeric));
    arffWriter.WriteAttribute(new ArffAttribute("class", ArffAttributeType.Nominal("Iris-setosa", "Iris-versicolor", "Iris-virginica")));
    arffWriter.WriteInstance(new object[] { 5.1, 3.5, 1.4, 0.2, 0 });
}

Instances are represented as object[] whose elements correspond to the attribute values. ARFF attribute types are mapped to .NET types as follows:

ARFF attribute type .NET type
numeric, integer, real double
nominal int
string string
date DateTime
relational object[][]

Missing values are represented as null. Sparse instances are represented as normal instances in memory.

  • net5.0

    • No dependencies.

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.1.3 88 8/28/2021
1.1.2 1,320 4/21/2017
1.1.1 619 3/20/2017
1.1.0 640 1/25/2017
1.0.1 901 8/4/2016
1.0.0 857 8/4/2016

The library has been updated to target .NET 5.0 instead of .NET Framework.