Giter VIP home page Giter VIP logo

neuralogic's People

Contributors

dependabot[bot] avatar gustiks avatar lukaszahradnik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

neuralogic's Issues

Inconsistent Value formatting

Current behavior:

  • ScalarValue::toString() formats the value to 10 decimal places (Settings.detailedNumberFormat).
  • VectorValue::toSring() formats the value to 2 decimal places (Settings.shortNumberFormat).
  • MatrixValue::toString() does not use number formatter - formats numbers to 16 decimal places.
  • One::toString() formats the value to 0 decimal places.
  • Zero::toString() formats the value to 0 decimal places.

This behavior results in inconsistent numbers rendering and larger rendered graphs (because matrices strings are too wide).
The drawing/rendering looks like it is supposed to be customizable via Drawer.numberFormat property, but this property is not used anywhere.

Expected behavior:

At least non-constant values (Scalar, Vector, and Matrix) use the same (parametrized) number formatter.

SoftEntropy overflow resulting in NaN

The bug description

The SoftEntropy error function produces NaN values for higher input values.
I identified problems in three different places:

Steps to reproduce

        VectorValue in = new VectorValue(
                new double[] {
                        19056.858719905307, 4960.272544490949, 11971.046875371912,
                        5381.27145922252, 12381.873594408318, 4820.585859773736
                }
        );

        VectorValue target = new VectorValue(new double[] {0, 0, 0, 0, 0, 1});

        System.out.println(new SoftEntropy().evaluate(in, target));
        System.out.println(new SoftEntropy().differentiate(in, target));

Outputs:

NaN
[NaN,NaN,NaN,NaN,NaN,NaN]

Comparison method violates its general contract

The Value::compareTo violates the transitivity contract. For example:

VectorValue a = new VectorValue(new double[]{0.047629895714159626, 0.047604189443657435, 0.04854122567285466, 0.04761906321919965, 0.04738330389768908, 0.048210586527278, 0.047356453205930266, 0.04779385977269353, 0.04749880890690395, 0.049574893497338526, 0.0473965862144424, 0.04752080406323121, 0.05822692203068567, 0.04901807601925808, 0.04765455362607377, 0.05002604412125539, 0.05739356645498594, 0.047385976587184166, 0.0688271909926611, 0.047338000032517556});
VectorValue b = new VectorValue(new double[]{0.05230714877347989, 0.04768642416075893, 0.04828379450589333, 0.04748746042330981, 0.047413899100790274, 0.0480960111883369, 0.04760666402944034, 0.04780428311901668, 0.04741611488536501, 0.048049785025318044, 0.06407256569995881, 0.04745754447958131, 0.05822264359013865, 0.04743569428412833, 0.05136507865966237, 0.050132734147586, 0.04761751121968647, 0.05404798031492382, 0.0481002774579048, 0.04939638493472022});
VectorValue c = new VectorValue(new double[]{0.047687861504175824, 0.04853932979708919, 0.05375328444286901, 0.06789273268891113, 0.04752737473067581, 0.04765000054474707, 0.04752381588854653, 0.05315426060101445, 0.04825011418905211, 0.048603366978242836, 0.0482348444133695, 0.04745493855841848, 0.05201354770686542, 0.048210370136723586, 0.04875627392006865, 0.048451973613676286, 0.04850025765899207, 0.048359046978719435, 0.05203654183998997, 0.047400063807852756});

System.out.println("A  B " + a.compareTo(b)); // Outputs 0 - A == B
System.out.println("B  C " + b.compareTo(c)); // Outputs 0 - B == C
System.out.println("A  C " + a.compareTo(c)); // Outputs -1 - A < C

This becomes an issue when I want to assign VectorValue as a label for a query (for example, in the case of clutrr). There is sorting of a collection of result (Vector) values happening here, which requires transitivity property and crashes NeuraLogic (does not happen in the Python frontend, as this part is not used).

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.