Package org.apache.mahout.ep

Examples of org.apache.mahout.ep.Mapping.apply()


  @Test
  public void testSoftLimitDeserialization() {
    Mapping m = ModelSerializer.gson().fromJson(new StringReader("{\"min\":-18.420680743952367,\"max\":-2.3025850929940455,\"scale\":1.0}"), Mapping.SoftLimit.class);
    assertTrue(m instanceof Mapping.SoftLimit);
    assertEquals((-18.420680743952367 - 2.3025850929940455) / 2, m.apply(0), 1.0e-6);

    String data = "{\"class\":\"org.apache.mahout.ep.Mapping$SoftLimit\",\"value\":{\"min\":-18.420680743952367,\"max\":-2.3025850929940455,\"scale\":1.0}}";
    m = ModelSerializer.gson().fromJson(new StringReader(data), Mapping.class);
    assertTrue(m instanceof Mapping.SoftLimit);
    assertEquals((-18.420680743952367 - 2.3025850929940455) / 2, m.apply(0), 1.0e-6);
View Full Code Here


    assertEquals((-18.420680743952367 - 2.3025850929940455) / 2, m.apply(0), 1.0e-6);

    String data = "{\"class\":\"org.apache.mahout.ep.Mapping$SoftLimit\",\"value\":{\"min\":-18.420680743952367,\"max\":-2.3025850929940455,\"scale\":1.0}}";
    m = ModelSerializer.gson().fromJson(new StringReader(data), Mapping.class);
    assertTrue(m instanceof Mapping.SoftLimit);
    assertEquals((-18.420680743952367 - 2.3025850929940455) / 2, m.apply(0), 1.0e-6);
  }

  @Test
  public void testMappingDeserialization() {
    String data = "{\"class\":\"org.apache.mahout.ep.Mapping$LogLimit\",\"value\":{\"wrapped\":{\"class\":\"org.apache.mahout.ep.Mapping$SoftLimit\",\"value\":{\"min\":-18.420680743952367,\"max\":-2.3025850929940455,\"scale\":1.0}}}}";
View Full Code Here

  @Test
  public void testMappingDeserialization() {
    String data = "{\"class\":\"org.apache.mahout.ep.Mapping$LogLimit\",\"value\":{\"wrapped\":{\"class\":\"org.apache.mahout.ep.Mapping$SoftLimit\",\"value\":{\"min\":-18.420680743952367,\"max\":-2.3025850929940455,\"scale\":1.0}}}}";
    Mapping m = ModelSerializer.gson().fromJson(new StringReader(data), Mapping.class);
    assertTrue(m instanceof Mapping.LogLimit);
    assertEquals(Math.sqrt(Math.exp(-18.420680743952367) * Math.exp(-2.3025850929940455)), m.apply(0), 1.0e-6);
  }

  @Test
  public void onlineAucRoundtrip() {
    RandomUtils.useTestSeed();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.