# Path: DSTK/GAM/gam.py
# def _recurse(tree, feature_vec):
# def _get_sum_of_gamma_correction(tree, data, labels, class_weights, feature_name):
# def _get_shape_for_attribute(attribute_data, labels, class_weights, feature_name, criterion, splitter,
#                              max_depth, min_samples_split, min_samples_leaf, min_weight_fraction_leaf,
#                              max_features, random_state, max_leaf_nodes, presort):
#     def __init__(self, **kwargs):
#     def _get_metadata_dict(self):
#     def _train_cost(self, data, labels):
#     def _get_pseudo_responses(self, data, labels):
#     def _init_shapes_and_data(self, data, labels):
#     def _update_learning_rate(self, dct, epoch):
#     def _initialize_class_weights(self, labels):
#     def _get_class_weights(self, labels):
#     def train(self, data, targets, **kwargs):
#     def _get_trimmed_record_indices(self, responses):
#     def _calculate_gradient_shape(self, data, labels, bag_indices=None, max_workers=1):
#     def __init__(self, gam):
#     def __getattr__(self, item):
#     def smoothen(self, data, penalty=None):
#     def _create_smooth_shape(shape, values, name, penalties):
#     def _fit_spline(values, target_vals, penalties):
# class GAM(BaseGAM):
# class SmoothGAM(BaseGAM):


import pytest
import numpy as np
from DSTK.GAM.gam import ShapeFunction
    func1 = ShapeFunction(np.linspace(1, 3, 3), np.linspace(1, 3, 3), 'test_1')
    func2 = ShapeFunction(np.linspace(1, 3, 3), 0.5 * np.linspace(1, 3, 3), 'test_2')

    assert func1.multiply(0.5).equals(func2)


def test_func_add():
    func1 = ShapeFunction(np.linspace(1, 3, 3), np.linspace(1, 3, 3), 'test_1')
    func2 = ShapeFunction(np.linspace(1.5, 10.5, 5), -1 * np.linspace(1, 10, 5), 'test_1')

    assert func1 != func2

    func3 = ShapeFunction([1.0, 1.5, 2.0, 3.0, 3.75, 6.0, 8.25, 10.5],
                          [1.0, -1.0, 2.0, 3.0, -3.25, -5.5, -7.75, -10.0], 'test_1')

    assert func1.add(func2).equals(func3)


def test_func_add_2():
    func1 = ShapeFunction([np.PINF], [0], 'test_1')
    func2 = ShapeFunction([0, 1, 2], [-1, 1, -2], 'test_1')

    assert func1 != func2

    func3 = ShapeFunction([0.0, 1.0, 2.0, np.PINF],
                          [-1.0, 1.0, -2.0, 0.0], 'test_1')

    assert func1.add(func2).equals(func3)



# Path: DSTK/GAM/gam.py
# def _recurse(tree, feature_vec):
# def _get_sum_of_gamma_correction(tree, data, labels, class_weights, feature_name):
# def _get_shape_for_attribute(attribute_data, labels, class_weights, feature_name, criterion, splitter,
#                              max_depth, min_samples_split, min_samples_leaf, min_weight_fraction_leaf,
#                              max_features, random_state, max_leaf_nodes, presort):
#     def __init__(self, **kwargs):
#     def _get_metadata_dict(self):
#     def _train_cost(self, data, labels):
#     def _get_pseudo_responses(self, data, labels):
#     def _init_shapes_and_data(self, data, labels):
#     def _update_learning_rate(self, dct, epoch):
#     def _initialize_class_weights(self, labels):
#     def _get_class_weights(self, labels):
#     def train(self, data, targets, **kwargs):
#     def _get_trimmed_record_indices(self, responses):
#     def _calculate_gradient_shape(self, data, labels, bag_indices=None, max_workers=1):
#     def __init__(self, gam):
#     def __getattr__(self, item):
#     def smoothen(self, data, penalty=None):
#     def _create_smooth_shape(shape, values, name, penalties):
#     def _fit_spline(values, target_vals, penalties):
# class GAM(BaseGAM):
# class SmoothGAM(BaseGAM):


# Path: DSTK/tests/tests_gam/test_shape_function.py
import pytest
import numpy as np
from DSTK.GAM.gam import ShapeFunction

    func1 = ShapeFunction(np.linspace(1, 3, 3), np.linspace(1, 3, 3), 'test_1')
    func2 = ShapeFunction(np.linspace(1, 3, 3), 0.5 * np.linspace(1, 3, 3), 'test_2')

    assert func1.multiply(0.5).equals(func2)


def test_func_add():
    func1 = ShapeFunction(np.linspace(1, 3, 3), np.linspace(1, 3, 3), 'test_1')
    func2 = ShapeFunction(np.linspace(1.5, 10.5, 5), -1 * np.linspace(1, 10, 5), 'test_1')

    assert func1 != func2

    func3 = ShapeFunction([1.0, 1.5, 2.0, 3.0, 3.75, 6.0, 8.25, 10.5],
                          [1.0, -1.0, 2.0, 3.0, -3.25, -5.5, -7.75, -10.0], 'test_1')

    assert func1.add(func2).equals(func3)


def test_func_add_2():
    func1 = ShapeFunction([np.PINF], [0], 'test_1')
    func2 = ShapeFunction([0, 1, 2], [-1, 1, -2], 'test_1')

    assert func1 != func2

    func3 = ShapeFunction([0.0, 1.0, 2.0, np.PINF],
                          [-1.0, 1.0, -2.0, 0.0], 'test_1')

    assert func1.add(func2).equals(func3)



def test_func_add_fails_with_different_features():