GithubHelp home page GithubHelp logo

naturalness's Introduction

naturalness

Library implementing "On the Naturalness of Software"

JavaScript

npm install
npm test
const naturalness = require('./index.js');
const Event = naturalness.Event;
const Sequence = naturalness.Sequence;
const NaturalnessModel = naturalness.NaturalnessModel;

let a = new Event('a');
let b = new Event('b');
let c = new Event('c');
let d = new Event('d');
let e = new Event('e');
let f = new Event('f');

let one = new Sequence([a, b, c, d, e]);
let two = new Sequence([a, b, c, d, c]);
let three = new Sequence([f, f, f, f, f, f, f, f, f, f]);

let model = new NaturalnessModel();

model.learn(one);
model.learn(two);
let crossEntropy = model.crossEntropy(three);

console.log(`crossEntropy is : ${crossEntropy}`);

Java

mvn compile
mvn test
List<Sequence> sequenceList = new ArrayList<Sequence>();
Event a = new Event("a");
Event b = new Event("b");
Event c = new Event("c");
Event d = new Event("d");
Event e = new Event("e");
sequenceList.add(new Sequence(Arrays.asList(a, b, c, d, e)));
sequenceList.add(new Sequence(Arrays.asList(a, b, c, d, c)));
NaturalnessModel model = new NaturalnessModel(3,0);
model.learn(sequenceList.get(0));
double ce = model.crossEntropy(sequenceList.get(1));

naturalness's People

Contributors

xblanc33 avatar

Watchers

James Cloos avatar  avatar

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.