namespace LabelerCore.Model.Transformers
{
    public class Weight: ITransformer
    {
        public readonly double[] weights;

        public Weight(double[] weights) 
        {
            this.weights = weights;
        }

        public void Fit(double[][] X, int[] y = null)
        {

        }

        public double[][] FitTransform(double[][] X, int[] y = null)
        {
            return Transform(X);
        }

        public double[][] Transform(double[][] X)
        {
            CheckInputs.CheckNumberOfFeatures(X, weights);
            double[][] ret = new double[X.Length][];
            for (int i = 0; i < X.Length; i++)
                ret[i] = Transform(X[i]);
            return ret;
        }

        public double[] Transform(double[] x)
        {
            CheckInputs.CheckNumberOfFeatures(x, weights);
            double[] ret = new double[x.Length];
            for (int i = 0; i < x.Length; i++)
                ret[i] = weights[i] * x[i];
            return ret;

        }

        public object Clone()
        {
            return this.MemberwiseClone();
        }

    }
}
