<commit_before>package hex;

import static hex.NeuralNet.*;
import static water.util.MRUtils.sampleFrame;
import hex.deeplearning.DeepLearning;
import hex.deeplearning.DeepLearningModel;
import hex.deeplearning.DeepLearningTask;
import hex.deeplearning.Neurons;
import junit.framework.Assert;
import org.junit.BeforeClass;
import water.JUnitRunnerDebug;
import water.Key;
import water.TestUtil;
import water.UKV;
import water.fvec.Frame;
import water.fvec.NFSFileVec;
import water.fvec.ParseDataset2;
import water.fvec.Vec;
import water.util.Log;
import water.util.Utils;

import java.util.Random;

public class DeepLearningVsNeuralNet extends TestUtil {
  Frame _train, _test;

  @BeforeClass public static void stall() {
    stall_till_cloudsize(JUnitRunnerDebug.NODES);
  }

  void compareVal(float a, float b, float abseps, float releps) {
    // check for equality
    if (Float.compare(a, b) == 0) {
    }
    // check for small relative error
    else if (Math.abs(a-b)/Math.max(a,b) < releps) {
    }
    // check for small absolute error
    else if (Math.abs(a - b) <= abseps) {
    }
    // fail
    else {
//      Log.err("Not close enough: " + a + " " + b);
      Assert.failNotEquals("Not equal: ", a, b);
    }
  }

//  @Test
  public void compare() throws Exception {
    final long seed = 0xc0ffee;
    Random rng = new Random(seed);

    DeepLearning.Activation[] activations = {
            DeepLearning.Activation.Maxout,
            DeepLearning.Activation.MaxoutWithDropout,
            DeepLearning.Activation.Tanh,
            DeepLearning.Activation.TanhWithDropout,
            DeepLearning.Activation.Rectifier,
            DeepLearning.Activation.RectifierWithDropout,
    };
    DeepLearning.Loss[] losses = {
            DeepLearning.Loss.MeanSquare,
            DeepLearning.Loss.CrossEntropy
    };
    DeepLearning.InitialWeightDistribution[] dists = {
            DeepLearning.InitialWeightDistribution.Normal,
            DeepLearning.InitialWeightDistribution.Uniform,
            DeepLearning.InitialWeightDistribution.UniformAdaptive
    };
    double[] initial_weight_scales = {<commit_msg>Ignore DLvsNN Junit test properly.<commit_after>package hex;

import static hex.NeuralNet.*;
import static water.util.MRUtils.sampleFrame;
import hex.deeplearning.DeepLearning;
import hex.deeplearning.DeepLearningModel;
import hex.deeplearning.DeepLearningTask;
import hex.deeplearning.Neurons;
import junit.framework.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import water.JUnitRunnerDebug;
import water.Key;
import water.TestUtil;
import water.UKV;
import water.fvec.Frame;
import water.fvec.NFSFileVec;
import water.fvec.ParseDataset2;
import water.fvec.Vec;
import water.util.Log;
import water.util.Utils;

import java.util.Random;

public class DeepLearningVsNeuralNet extends TestUtil {
  Frame _train, _test;

  @BeforeClass public static void stall() {
    stall_till_cloudsize(JUnitRunnerDebug.NODES);
  }

  void compareVal(float a, float b, float abseps, float releps) {
    // check for equality
    if (Float.compare(a, b) == 0) {
    }
    // check for small relative error
    else if (Math.abs(a-b)/Math.max(a,b) < releps) {
    }
    // check for small absolute error
    else if (Math.abs(a - b) <= abseps) {
    }
    // fail
    else {
//      Log.err("Not close enough: " + a + " " + b);
      Assert.failNotEquals("Not equal: ", a, b);
    }
  }

  @Ignore
  @Test
  public void compare() throws Exception {
    final long seed = 0xc0ffee;
    Random rng = new Random(seed);

    DeepLearning.Activation[] activations = {
            DeepLearning.Activation.Maxout,
            DeepLearning.Activation.MaxoutWithDropout,
            DeepLearning.Activation.Tanh,
            DeepLearning.Activation.TanhWithDropout,
            DeepLearning.Activation.Rectifier,
            DeepLearning.Activation.RectifierWithDropout,
    };
    DeepLearning.Loss[] losses = {
            DeepLearning.Loss.MeanSquare,
            DeepLearning.Loss.CrossEntropy
    };
    DeepLearning.InitialWeightDistribution[] dists = {
            DeepLearning.InitialWeightDistribution.Normal,
            DeepLearning.InitialWeightDistribution.Uniform,
            DeepLearning.InitialWeightDistribution.UniformAdaptive
    };
    double[] initial_weight_scales = {
{'fraction_non_alphanumeric': 0.09965397923875433, 'fraction_numerical': 0.001845444059976932, 'mean_word_length': 3.1812921890067503, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '817207', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1297, 'n_words': 279}