<commit_before>package pl.magosa.microbe;

import org.junit.BeforeClass;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * (c) 2014 <NAME>
 */
public class TanhTransferFunctionTest {
    private static TransferFunction transferFunction;

    @BeforeClass
    public static void setUp() {
        transferFunction = new TanhTransferFunction();
    }

    @Test
    public void testFunction() {
        assertEquals(0.76159415595576, transferFunction.function(1.0), 0.001);
        assertEquals(0.0, transferFunction.function(0.0), 0.001);
        assertEquals(0.46211715726001, transferFunction.function(0.5), 0.001);
        assertEquals(-0.76159415595576, transferFunction.function(-1.0), 0.001);
    }

    @Test
    public void testDerivative() {
        assertEquals(0.97754116486012, transferFunction.derivative(transferFunction.function(0.151)), 0.001);
        assertEquals(0.74120496390821, transferFunction.derivative(transferFunction.function(0.561)), 0.001);
    }

    @Test
    public void testGetUpperLimit() {
        assertEquals(1.0, transferFunction.getUpperLimit(), 0.001);
    }

    @Test
    public void testGetLowerLimit() {
        assertEquals(-1.0, transferFunction.getLowerLimit(), 0.001);
    }
}<commit_msg>extend: TanhTransferFunctionTest - makeArray<commit_after>package pl.magosa.microbe;

import org.junit.BeforeClass;
import org.junit.Test;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;

/**
 * (c) 2014 <NAME>
 */
public class TanhTransferFunctionTest {
    private static TransferFunction transferFunction;

    @BeforeClass
    public static void setUp() {
        transferFunction = new TanhTransferFunction();
    }

    @Test
    public void testFunction() {
        assertEquals(0.76159415595576, transferFunction.function(1.0), 0.001);
        assertEquals(0.0, transferFunction.function(0.0), 0.001);
        assertEquals(0.46211715726001, transferFunction.function(0.5), 0.001);
        assertEquals(-0.76159415595576, transferFunction.function(-1.0), 0.001);
    }

    @Test
    public void testDerivative() {
        assertEquals(0.97754116486012, transferFunction.derivative(transferFunction.function(0.151)), 0.001);
        assertEquals(0.74120496390821, transferFunction.derivative(transferFunction.function(0.561)), 0.001);
    }

    @Test
    public void testGetUpperLimit() {
        assertEquals(1.0, transferFunction.getUpperLimit(), 0.001);
    }

    @Test
    public void testGetLowerLimit() {
        assertEquals(-1.0, transferFunction.getLowerLimit(), 0.001);
    }

    @Test
    public void makeArray() {
        double[] result = transferFunction.makeArray(5, new int[] { 1, 2 });
        assertArrayEquals(new double[] { -1.0, 1.0, 1.0, -1.0, -1.0 }, result, 0.01);
    }
}
{'fraction_non_alphanumeric': 0.12495562655307065, 'fraction_numerical': 0.10010649627263046, 'mean_word_length': 3.5088, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4824748', 'n_tokens_mistral': 1018, 'n_tokens_neox': 849, 'n_words': 159}