Giter Site home page Giter Site logo

heraclitus-oracle's People

Contributors

pierwill avatar

Watchers

 avatar  avatar  avatar

heraclitus-oracle's Issues

Incorrect model?

Getting models like this:

(['d', 'f', 'd', 'f', 'd'], Score { f: 0, d: 33 })
(['f', 'f', 'f', 'f', 'f'], Score { f: 4, d: 0 })
(['d', 'd', 'd', 'd', 'd'], Score { f: 0, d: 7 })
(['d', 'f', 'f', 'f', 'd'], Score { f: 0, d: 4 })
(['d', 'd', 'f', 'd', 'f'], Score { f: 0, d: 12 })
(['f', 'd', 'd', 'd', 'd'], Score { f: 5, d: 0 })
(['d', 'd', 'd', 'd', 'f'], Score { f: 0, d: 5 })
(['d', 'f', 'd', 'd', 'd'], Score { f: 0, d: 11 })
(['f', 'd', 'f', 'd', 'd'], Score { f: 10, d: 0 })
(['f', 'f', 'd', 'd', 'd'], Score { f: 5, d: 0 })
(['d', 'f', 'f', 'd', 'd'], Score { f: 0, d: 3 })
(['d', 'd', 'd', 'f', 'f'], Score { f: 0, d: 2 })
(['d', 'f', 'd', 'f', 'f'], Score { f: 0, d: 10 })
(['d', 'd', 'd', 'f', 'd'], Score { f: 0, d: 14 })
(['f', 'f', 'd', 'f', 'f'], Score { f: 1, d: 0 })
(['f', 'd', 'd', 'd', 'f'], Score { f: 11, d: 0 })
(['f', 'd', 'f', 'd', 'f'], Score { f: 32, d: 0 })
(['d', 'f', 'd', 'd', 'f'], Score { f: 0, d: 5 })
(['d', 'd', 'f', 'd', 'd'], Score { f: 0, d: 6 })
(['d', 'f', 'f', 'f', 'f'], Score { f: 0, d: 6 })
(['d', 'd', 'f', 'f', 'd'], Score { f: 0, d: 3 })
(['f', 'f', 'f', 'd', 'd'], Score { f: 3, d: 0 })
(['f', 'f', 'f', 'f', 'd'], Score { f: 6, d: 0 })
(['f', 'f', 'd', 'd', 'f'], Score { f: 1, d: 0 })
(['f', 'f', 'd', 'f', 'd'], Score { f: 8, d: 0 })
(['f', 'd', 'f', 'f', 'f'], Score { f: 9, d: 0 })
(['d', 'd', 'f', 'f', 'f'], Score { f: 0, d: 1 })
(['d', 'f', 'f', 'd', 'f'], Score { f: 0, d: 2 })
(['f', 'd', 'd', 'f', 'd'], Score { f: 4, d: 0 })
(['f', 'd', 'd', 'f', 'f'], Score { f: 2, d: 0 })
(['f', 'd', 'f', 'f', 'd'], Score { f: 2, d: 0 })
(['f', 'f', 'f', 'd', 'f'], Score { f: 7, d: 0 })

where either Score.f or Score.d is always zero. ๐Ÿค”

Deduplicate `match` arms

This duplication does not spark joy:

Key::Char('f') => {
// record key press
all_keys.push('f');
let lastfive: Vec<char> = all_keys.clone().into_iter().rev().take(5).collect();
let predicted = predict(model.clone(), lastfive.clone());
let observed = lastfive.iter().rev().last().unwrap();
write!(
stdout,
"{}{}",
termion::clear::All,
termion::cursor::Goto(1, 1)
)
.unwrap();
write!(stdout, "{:?}{}", lastfive, termion::cursor::Goto(1, 2),).unwrap();
write!(
stdout,
"predicted: {}, observed: {}{}",
predicted,
observed,
termion::cursor::Goto(1, 3),
)
.unwrap();
// record guesses
guesses.total += 1;
if predicted == *observed {
guesses.correct += 1;
}
println!(
"guess %: {:.1}",
(guesses.correct as f32 / guesses.total as f32) * 100.0
);
// update model
model = update_model(model, all_keys.clone());
}
Key::Char('d') => {
all_keys.push('d');
let lastfive: Vec<char> = all_keys.clone().into_iter().rev().take(5).collect();
let predicted = predict(model.clone(), lastfive.clone());
let observed = lastfive.iter().rev().last().unwrap();
write!(
stdout,
"{}{}",
termion::clear::All,
termion::cursor::Goto(1, 1)
)
.unwrap();
write!(stdout, "{:?}{}", lastfive, termion::cursor::Goto(1, 2),).unwrap();
write!(
stdout,
"predicted: {}, observed: {}{}",
predicted,
observed,
termion::cursor::Goto(1, 3),
)
.unwrap();
// record guesses
guesses.total += 1;
if predicted == *observed {
guesses.correct += 1;
}
println!(
"guess %: {:.1}",
(guesses.correct as f32 / guesses.total as f32) * 100.0
);
// update model
model = update_model(model, all_keys.clone());
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.