Commit Graph
309 Commits
Author SHA1 Message Date
jensandClaude Sonnet 5 60da2f0b04 Migrate all project files from repo root into prj/<name>/
Moved all 40 existing projects' .prj/.dat files (Layer weights, training
batches, legacy .weights.dat/.test.dat artifacts) from the flat repo root
into their own prj/<name>/ folder via git mv, matching the new path
convention from the previous commit. Filenames are unchanged, only the
directory. Non-project files at root (CLAUDE.md, Makefile, batch/moby
text corpora, the stray Layer.0.training.mat) were left in place.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016K8Gu7Qejd11JbdiHZqYAs
2026-07-27 14:44:08 +02:00
jensandClaude Sonnet 5 ca27e1e705 Route project files through prj/<name>/ instead of flat at repo root
Repo root had ~35 groups of .prj/.dat files loose alongside the build
system and source, all sharing one flat namespace. Centralize the new
prj/<name>/ convention inside AStack::loadWeights/saveWeights/
loadTrainingBatch/saveTrainingBatch and StackCreator::fromFile/toFile
(via a new AStack::projectDir() helper) -- these already have access to
the project name, so callers (poet.cpp, the GUI) need no changes at all;
they keep passing the same base directory they always did.

Filenames inside each project folder are unchanged (e.g.
prj/mnist_2/mnist_2.prj, prj/mnist_2/mnist_2.Layer.0.w.dat) -- only the
directory moves. Added Matutils::ensureDir() (mkdir -p equivalent; no
std::filesystem in C++11) since ofstream won't create directories, used
wherever a project is saved for the first time.

File migration for existing projects is a separate commit.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016K8Gu7Qejd11JbdiHZqYAs
2026-07-27 14:41:05 +02:00
jensandClaude Sonnet 5 4cf5f15555 Fix cd_jens positive phase using noisy sample instead of mean
doGaussianHidden took priority over doRaoBlackwell when deciding h_states
for the positive-phase gradient, so a Gaussian-hidden RBM always got the
noisy sample (h_probs + randn) for dw/dbh even with doRaoBlackwell set --
ignoring the flag and adding avoidable gradient variance. Standard CD
practice (and pyRBM's cd_gaussian_gaussian) uses the mean for the
weight/bias gradient when Rao-Blackwellizing, regardless of unit type.

Reordered so doRaoBlackwell is checked first (mean, any unit type) and
only samples otherwise, dispatching via the sampleHidden() helper added
in the previous commit so Gaussian/binary hidden units are each sampled
correctly. Behavior-preserving for poet (doRaoBlackwell=true,
doGaussianHidden=false already took the mean branch); only changes
behavior for a Gaussian-hidden RBM trained with doRaoBlackwell enabled.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016K8Gu7Qejd11JbdiHZqYAs
2026-07-27 13:57:46 +02:00
jensandClaude Sonnet 5 eb29e33b81 Fix Bernoulli-only sample() applied to Gaussian visible/hidden units
Matutils::sample() always binary-thresholds (src > uniform(src)), but it
was the only sampler in the codebase and was called unconditionally on
h_probs/v_probs/miniBatch in several CD Gibbs-loop branches regardless
of doGaussianVisible/doGaussianHidden. Binary-thresholding a Gaussian
unit's continuous activation is meaningless -- it would corrupt any
Gaussian-visible/hidden RBM (image-domain experiments via the GUI or
TEST target); doesn't affect poet's plain BB-RBM path since both flags
are false there.

Add sample_gaussian() (mean + N(0,1) noise) alongside the existing
Bernoulli sample() in matutils.hpp, plus Rbm::sampleVisible/sampleHidden
helpers that dispatch to the right one per the RBM's configured type.
Replace every visible/hidden Gibbs-step sample() call in cd_jens (the
active path) and cd_hinton (compiled but currently unused, behind
USE_CD_HINTON) with the appropriate dispatch helper, and fix the same
issue in Rbm::train's doSampleBatch path.

Behavior is unchanged for any RBM with doGaussianVisible/doGaussianHidden
both false (confirmed: poet.elf f output identical before/after).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016K8Gu7Qejd11JbdiHZqYAs
2026-07-27 13:45:03 +02:00
jensandClaude Sonnet 5 aabf7385ce Fix RBM training: invert epoch/mini-batch loop nesting, drop duplicate CD computation
Rbm::train had mini-batch chunks as the outer loop and epochs as the
inner loop: each fixed, never-reshuffled slice of the data got all
numEpochs gradient steps back-to-back before ever being revisited, so
"numEpochs" didn't mean "passes over the whole dataset" and training
was biased toward whatever data came last. Invert the nesting (epochs
outer, mini-batches inner, batch reshuffled via arma::shuffle at the
start of each epoch) so every epoch is an actual full pass over the
data in a fresh random order.

Also drop a redundant toHiddenProbs(v_states) call in cd_jens: the
positive-phase hidden probabilities were computed once unconditionally
and then discarded, recomputed a second time with identical input in
two of the three sampling branches. Same result, half the cost, on
every mini-batch of every epoch of every layer.

Both only affect training; inference (step_forward/generation) is
unchanged, confirmed by identical poet.elf f output before and after.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016K8Gu7Qejd11JbdiHZqYAs
2026-07-27 13:39:58 +02:00
jensandClaude Sonnet 5 656a0252d3 Wire up temperature-based sampling for poet text generation
Greedy argmax decoding in RbmListener::forward always produces the
exact same character sequence and quickly falls into short repeating
loops once the 5-character lookback state revisits a prior cycle.

Add an optional temperature argument (poet f <seed> [temperature]) that
switches decoding to RnnStack::sample_one_hot, which now does proper
categorical sampling (temperature-scaled, renormalized draw) instead of
the old per-code Bernoulli approach that could leave the result as a
non-one-hot probability vector. Also seed Armadillo's RNG in main(),
since it otherwise defaults to a fixed seed and every run would sample
identically.

Add docs/RNN_ARCHITECTURE.md documenting how the RnnStack/Layer stack
implements the RNN (context chaining across layers, training/generation
data flow, and the decoding behavior above).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016K8Gu7Qejd11JbdiHZqYAs
2026-07-27 12:34:44 +02:00
jensandClaude Sonnet 5 33a0647a51 Add CLAUDE.md with build commands and architecture overview
Documents the PRJ/CONFIG-based Makefile build, external deps
(Armadillo, JsonCpp, JUCE), and the Rbm/Layer/AStack (DeepStack/RnnStack)
core architecture plus the three entry points (main.cpp, poet.cpp, gui.cpp).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019113s2pJdTtsUqsBdFgQAk
2026-07-26 23:04:43 +02:00
jens e009967516 commit stale changes 2026-07-26 21:50:50 +02:00
jens f805b571d9 commit stale changes 2026-07-26 21:49:32 +02:00
jens cb55e31b19 Fixed libs for GUI 2024-05-09 22:16:20 +02:00
jens a86321aa49 added CR at the end of file 2024-05-05 12:35:44 +02:00
jens 1af74b0372 No linking of graphics libs for console app 2024-05-05 12:12:44 +02:00
jens 2333e94915 - added new cool projects 2024-03-04 09:00:16 +01:00
jens 813d4e404c - improved norb_small
- improved prims_deep
2024-03-04 08:58:48 +01:00
jens 32c3526ba7 - Rbm::Params: Momentum default 0.9 2024-02-03 09:49:13 +01:00
jens 6f7e100b27 - updated char_embedd.prj 2024-02-03 09:06:13 +01:00
jens 75463d7b60 - updated prims_lin_hid.prj 2024-02-02 19:14:32 +01:00
jens 3ef91fb086 - updated prims_lin_hid.prj 2024-02-02 19:02:58 +01:00
jens 560724c43e - updated norb_small_16h.prj 2024-02-02 18:59:48 +01:00
jens 324a56557b - use cd_jens() 2024-02-02 18:59:04 +01:00
jens 5321e01cca - improved cd_hinton()
- uniform() returns vector
2024-02-01 19:03:13 +01:00
jens 8e44aff7a5 - prepare cd_jens() for linear hidden units 2024-01-31 20:52:18 +01:00
jens 802f11211f - added norb_smaller 2024-01-31 17:15:23 +01:00
jens 861e03decf - DrawComponent: fixed normalizing to screen 2024-01-31 16:55:41 +01:00
jens 587c3dfcbf - added small norb project 2024-01-31 15:30:10 +01:00
jens 75e71bd060 - use auto detect for training data load 2024-01-31 15:29:38 +01:00
jens e74de3df10 - use un-normalized norb training 2024-01-31 15:29:07 +01:00
jens ccc3e0ac87 - fixed total error calc 2024-01-31 12:52:29 +01:00
jens 2a2be76b2c - AStack:Load show mean and stddev 2024-01-31 12:20:15 +01:00
jens e211c568ac Rbm
- enable linear hidden : instead of prob(v_to_h()): use toHiddenProbs()
- enable linear visible: instead of prob(h_to_v()): use toVisibleProbs()
- make v_to_h() and h_to_v() private and force to use toHiddenProbs() and toVisibleProbs()
- use cd_jens or cd_hinton. cd_hinton_hid_lineaer is not of use anymre, since it is not capable of CDn
2024-01-31 12:03:47 +01:00
jens 285be92cdb - finally return normalized data 2024-01-31 11:40:41 +01:00
jens c0445f3bf8 - moved Rbm:prob() to Matutils::prob()
- Matutils::Normalize uses prob()
2024-01-29 13:04:13 +01:00
jens fe8142627d cd_hinton_hid_binary: added raoBlackwell, gibbs-sampling 2024-01-25 22:45:50 +01:00
jens 34b20f4fb3 - refactored
- switch between cd_hinton hid/linear and cd_jens using doGaussionVisible (temporary solution)
2024-01-24 19:22:57 +01:00
jens a5ed0be991 - added original implementation for binary RBM 2024-01-24 18:41:42 +01:00
jens 84a5dd4550 Refactored v1.0.0 2024-01-24 17:04:05 +01:00
jens b467180535 Initialize buttons rbmUseVisibleGaussianToggleButton and rbmUseHiddenGaussianToggleButton 2024-01-24 17:02:46 +01:00
jens 88f649e8f4 - refactored 2024-01-24 16:56:49 +01:00
jens 9a381c1899 - its gaussion hidden (not gaussian visible) 2024-01-24 15:14:30 +01:00
jens fe9b1951ea - Added gaussian hidden units 2024-01-24 14:47:21 +01:00
jens fb5ac6d124 Fixed normalization 2024-01-24 14:44:20 +01:00
jens 1d5cd55818 - added prims_deep 2024-01-23 21:05:39 +01:00
jens 4a7fcb387c - fixed normalization
- added sigmoid after normalization
2024-01-23 21:05:13 +01:00
jens bb6040779d - deleted 2024-01-22 21:36:46 +01:00
jens 00a56a0f54 - update poet5 2024-01-22 21:22:43 +01:00
jens e0e31842cb - update poet5 2024-01-22 20:52:50 +01:00
jens 4a16926030 - improved training data normalization 2024-01-22 19:53:12 +01:00
jens 3d317f8479 - updated vscode 2024-01-22 19:52:58 +01:00
jens 86a7047733 - deleted old context projects 2024-01-22 13:59:58 +01:00
jens 44445d3fd2 - fixed JUCE includes 2024-01-22 13:55:51 +01:00