Crate mokosh

Crate mokosh 

Source
Expand description

§Mokosh - Hierarchical Temporal Memory in Rust

Mokosh is a high-performance, idiomatic Rust implementation of Hierarchical Temporal Memory (HTM) algorithms, ported from the htm.core C++ library.

§Overview

HTM is a machine learning technology that aims to capture the structural and algorithmic properties of the neocortex. The main components include:

  • Sparse Distributed Representations (SDR): The fundamental data structure
  • Encoders: Convert various data types into SDRs
  • Spatial Pooler: Creates sparse representations of input patterns
  • Temporal Memory: Learns sequences and makes predictions
  • Anomaly Detection: Identifies unusual patterns in data streams

§Quick Start

use mokosh::prelude::*;

// Create an SDR with dimensions 10x10
let mut sdr = Sdr::new(&[10, 10]);

// Set some active bits
sdr.set_sparse(&[1, 4, 8, 15, 42]);

// Create a Spatial Pooler
let sp = SpatialPooler::new(SpatialPoolerParams {
    input_dimensions: vec![100],
    column_dimensions: vec![2048],
    ..Default::default()
});

// Create a Temporal Memory
let tm = TemporalMemory::new(TemporalMemoryParams {
    column_dimensions: vec![2048],
    cells_per_column: 32,
    ..Default::default()
});

§Feature Flags

  • std (default): Enable standard library features
  • serde: Enable serialization/deserialization support
  • rayon: Enable parallel processing
  • simd: Enable SIMD optimizations

Re-exports§

pub use error::MokoshError;
pub use error::Result;

Modules§

algorithms
HTM algorithms implementation.
encoders
Encoders for converting data into SDR representations.
error
Error types for the library.
prelude
Re-export of commonly used types and traits for convenience.
types
Core types for the HTM library.
utils
Utility modules for the HTM library.

Constants§

VERSION
Library version.