[NEW in v3.1.0] Kaggle-Style Data Science: Import CSVs & Batch Predictions! [v3.1.0 新機能] Kaggleスタイルの本格データ分析:CSVインポート&一括推論に対応!

Hakoniwa AI 箱庭小AI

Your First Step into AI Learning.

Learn how AI works right inside your smartphone.
Zero external communication. Perfect for beginners.
"A palm-sized laboratory to understand machine learning"
AIが動く仕組みを、あなたのスマホの中で学ぶ。
外部通信一切なし。機械学習の初学者に最適。
「手のひらサイズのAI実験室・学習統合環境」

Concept: See How AI Learns Concept: AIの学習を視覚的に理解する

Machine learning can seem intimidating, but "Hakoniwa AI" makes it accessible.
Instead of relying on cloud APIs, you will grow a "small brain" from scratch on your device. By observing its growth process (decreasing Loss) and watching how it learns to blend images or generate text, you can visually understand the foundational mechanisms of AI.
機械学習は難しそうに見えますが、「箱庭小AI」なら直感的に学べます。
クラウドのAIを使うのではなく、手のひらの中で「小さな脳」をゼロから育てます。誤差(Loss)が減っていく成長過程を観察し、画像が混ざり合う様子やテキストが生まれる瞬間を見ることで、AIの基礎となる仕組みを視覚的に理解することができます。

A highly optimized engine built from scratch allows you to experiment with Neural Networks, Random Forests, and Variational Autoencoders completely offline. ゼロから構築された独自の学習エンジンにより、ニューラルネットワーク、ランダムフォレスト、そして画像生成の基礎となる変分オートエンコーダ(VAE)といった本格的な技術を、完全オフラインでリアルタイムに実験できます。

Screenshots

* Images are from a development version ※画像は開発中のものです

Data Preprocessing Data Preprocessing
Image Generation VAE Image Generation (VAE)
Training and Analysis Training & Analysis
Settings Settings
Text Generation Mode Roundtable Mode

Features & Specs

1. Kaggle-Style Data Science (New!) 1. Kaggleスタイルのデータ分析体験 (新機能!)

Step into the shoes of a data scientist. Import massive CSV datasets directly from your device. Hakoniwa AI automatically handles complex preprocessing like filling missing values and filtering columns. Run batch predictions to generate your own submission files completely offline. It is designed to be the ultimate beginner-friendly bridge into real-world data science without needing to write complex code. データサイエンティストの分析プロセスをスマホで再現。巨大なCSVデータセットを読み込み、初心者がつまずきやすい「欠損値の補完」や「不要な列の除外」などの複雑なデータ前処理を全自動で実行します。学習済みモデルで一括推論を行い、提出用ファイルを作成する本格的な体験が完全オフラインで完結。コードを書かずに現実のデータサイエンスの世界へ踏み出せる、最高の入門機能です。

2. Image Generation (VAE) & Latent Space 2. 画像生成の仕組みを体感 (VAEモード)

Experience the magic behind modern image generation. Train a Variational Autoencoder (VAE) to generate 16x16 pixel art using your own photos. Adjust the latent space sliders to visually understand how AI blends and morphs different visual concepts together. 現代の画像生成AIの基礎となる仕組みを体験しましょう。変分オートエンコーダ(VAE)を学習させ、自身の写真から16x16のドット絵を生成します。潜在空間(Latent Space)のスライダーを操作することで、AIがどのように画像を混ぜ合わせ、滑らかに変形させるのかを直感的に学べます。

3. Text Generation with Real-Time Probabilities 3. 確率が見えるテキスト生成 (言語モデルの基礎)

Understand how modern AI generates text. Train a Small Language Model (SLM) based on N-grams and watch it generate text one character at a time, displaying the exact probability for each next character. A perfect hands-on introduction to Natural Language Processing. 現代のAIがどうやって文章を作っているのかを学びましょう。N-gramベースの小規模言語モデル(SLM)を学習させ、次に来る文字の確率を1文字ずつリアルタイムで確認しながらテキスト生成を観察できます。自然言語処理の入門に最適です。

4. Multiple Algorithms & Advanced Overfitting Prevention 4. 複数アルゴリズムと過学習対策の実験

Experiment not only with Neural Networks but also with the Random Forest algorithm. Learn how to prevent overfitting (a common beginner trap) using features like Dropout and L2 Regularization. Compare how different models perform on the same data. ニューラルネットワークだけでなく、ランダムフォレストアルゴリズムでの学習も可能です。さらに、機械学習の初心者がつまずきやすい「過学習」を防ぐためのドロップアウト機能L2正則化機能も実装。データに対してモデルがどう振る舞うかを比較実験できます。

5. Comprehensive Visual Analysis 5. AIの思考を暴く可視化ツール

Visually verify performance with Scatter Plots and a Confusion Matrix. Run Sensitivity Analysis to rigorously measure which data features impact the AI's decisions the most, helping you build an intuition for data science. 散布図混同行列 (Confusion Matrix) により、AIの精度とクセを視覚的に確認できます。さらに感度分析 (Permutation Importance) で判断根拠を数値化し、どのデータがAIの判断に影響を与えているかを分析することで、データサイエンスの直感を養えます。

6. Bonus: Export to Microcontrollers (TinyML) 6. おまけ機能: マイコンへのコード書き出し (TinyML)

Once you've trained your model, you can export the inference logic as raw C++, Python, Dart, or Rust code. You can even run it on an 8-bit Arduino Uno with just 2KB of RAM. 学習の仕組みを理解した後の応用編として、作成したモデルの推論ロジックをC++、Python、Dart、Rustコードとして書き出す機能を備えています。RAMが2KBしかないArduino等のマイコン上でも推論を動かすことができます。

Core Engine コアエンジン Pure Dart Machine Learning Engine (100% Offline / Scratch Build)
Supported Algorithms 対応アルゴリズム Multilayer Perceptron, Random Forest, Variational Autoencoder (VAE) 多層パーセプトロン, ランダムフォレスト, 変分オートエンコーダ (VAE)
Neural Network Features NN 詳細機能 0 to 5 hidden layers, up to 128 nodes/layer, Dropout, L2 Regularization 隠れ層0から5層 / 各層最大128ノード, ドロップアウト機能, L2正則化機能
Export Formats コード出力機能 Pure Python, Dart, C++11 (Rich/Bare-Metal), & Rust Pure Python, Dart, C++11 (リッチ/ベアメタル), Rust

Available on App Store & Google Play 各ストアで無料配信中

Download on the App Store Get it on Google Play

Source code is available on GitHub ソースコードをGitHubで公開中

View on GitHub

Compatible with iPhone / iPad / Android iPhone / iPad / Android 対応
* Also runs on Macs with Apple Silicon (M1 or later) ※ Apple Silicon (M1以降) 搭載のMacでも動作します

For Advanced Users: Export Code Examples

Expand the sections below to see examples of the generated C++/Rust code and core logic. 学習済みのモデルから実際に出力されるC++/Rustコードやロジックの例は、以下のアコーディオンから確認できます。

Exported TinyML Model (Bare-Metal C++)
/*
 * Auto-generated Hakoniwa AI Inference Model (Extreme Bare-Metal C++)
 * [! WARNING: PURE C/C++ MODE !]
 * - No dynamic memory allocation (No std::vector, std::string).
 * - Uses <math.h> only. Weights are stored in 'const' arrays (Flash Memory).
 * - Ultra-low RAM footprint. Perfect for Arduino Uno (ATmega328P).
 */
#include <math.h>

// --- Trained Parameters (Stored in Flash memory to save RAM) ---
const float weights_layer0[6][4] = {{-0.83f, 0.97f, -0.64f, 0.35f}, ...};
const float biases_layer0[4] = {0.04f, 0.16f, -0.01f, -0.04f};

// --- Core Inference Engine ---
// input: Raw normalized/one-hot encoded float array
void predict(const float input[6], float output[2]) {
    float buf_a[4] = {0};
    float buf_b[4] = {0};
    const float* current = input;
    float* next = buf_a;

    // Layer 0 Computation
    for (int j = 0; j < 4; j++) { next[j] = 0.0f; } // Zero clear buffer
    for (int j = 0; j < 4; j++) {
        float total = biases_layer0[j];
        for (int k = 0; k < 6; k++) {
            total += current[k] * weights_layer0[k][j];
        }
        // Activation (ReLU)
        next[j] = (total > 0.0f) ? total : 0.01f * total;
    }
    
    // ... [Buffer switching and Output Layer calculation omitted] ...
}

#if defined(ARDUINO)
void setup() {
    Serial.begin(115200);
    // Manual Data Preparation for {"1", "male", "50.0"}
    // Input 'Pclass' (Category: 1) -> One-hot encoded
    // Input 'Age' (Value: 50.0, Min: 0.0, Max: 100.0) -> Normalized to 0.5f
    float test_input[6] = {1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.5f};
    float result_output[2] = {0};

    unsigned long start_time = micros();
    predict(test_input, result_output);
    unsigned long end_time = micros();

    Serial.println("Predictions:");
    Serial.print("  Survived '0': ");
    Serial.println(result_output[0] * 100);
    Serial.print("Inference Time: ");
    Serial.println(end_time - start_time); // => e.g. "932 microseconds" (on Arduino Uno)"
}
void loop() {}
#endif
Exported Pure Rust Model (Zero Dependency)
// =====================================================================
// Auto-generated Hakoniwa AI Inference Model (Pure Rust)
// Zero external dependencies. Works out of the box with `cargo run`.
// Perfect for WebAssembly (WASM) or high-performance backend microservices.
// =====================================================================
use std::f64::consts::E;

pub struct HakoniwaModel {
    layer_sizes: Vec<usize>,
    // ... [Trained Weights, Biases & Feature Definitions injected here] ...
}

impl HakoniwaModel {
    fn predict_raw(&self, input_data: &[f64]) -> Vec<f64> {
        let mut current = input_data.to_vec();
        for i in 0..self.weights.len() {
            let mut next_layer = vec![0.0; self.layer_sizes[i + 1]];
            for j in 0..self.layer_sizes[i + 1] {
                let mut total = self.biases[i][j];
                for k in 0..self.layer_sizes[i] {
                    total += current[k] * self.weights[i][k][j];
                }
                // Apply activation function (e.g., ReLU)
                if i < self.weights.len() - 1 {
                    next_layer[j] = if total > 0.0 { total } else { 0.01 * total };
                } else {
                    next_layer[j] = total;
                }
            }
            current = next_layer;
        }
        current
    }
    // ... [JSON Formatting Logic omitted] ...
}
Core Backpropagation Logic (Dart)
// =====================================================================
// Backpropagation (Training Logic)
// Stripped of UI yields and async tasks for educational clarity.
// =====================================================================
double trainEpoch(List<List<double>> inputs, List<List<double>> expectedOutputs) {
  if (inputs.isEmpty) return 0.0;
  double totalLoss = 0.0;
  // Initialize gradients
  List<List<List<double>>> gradW = /*...*/;
  List<List<double>> gradB = /*...*/;

  for (int i = 0; i < inputs.length; i++) {
    List<double> x = inputs[i];
    List<double> y = expectedOutputs[i];
    List<List<double>> activations = _forward(x);
    List<double> o = activations.last;

    // Output layer deltas (e.g. MSE for Sigmoid)
    List<List<double>> deltas = /*...*/;
    for (int j = 0; j < o.length; j++) {
      totalLoss += pow(y[j] - o[j], 2);
      deltas.last[j] = (o[j] - y[j]) * o[j] * (1.0 - o[j]);
    }

    // Hidden layer deltas
    for (int l = weights.length - 2; l >= 0; l--) {
      for (int j = 0; j < layerSizes[l + 1]; j++) {
        double sum = 0.0;
        for (int k = 0; k < layerSizes[l + 2]; k++) {
          sum += deltas[l + 1][k] * weights[l + 1][j][k];
        }
        deltas[l][j] = sum * _derivative(activations[l + 1][j], hiddenActivation);
      }
    }

    // Accumulate gradients
    for (int l = 0; l < weights.length; l++) {
      for (int j = 0; j < layerSizes[l + 1]; j++) {
        gradB[l][j] += deltas[l][j];
        for (int k = 0; k < layerSizes[l]; k++) {
          gradW[l][k][j] += deltas[l][j] * activations[l][k];
        }
      }
    }
  }

  _applyGradients(gradW, gradB, inputs.length);
  return totalLoss / inputs.length;
}