All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hex.gam.MatrixFrameUtils.AddMSGamColumns Maven / Gradle / Ivy

There is a newer version: 3.46.0.6
Show newest version
package hex.gam.MatrixFrameUtils;

import hex.genmodel.algos.gam.MSplines;
import water.MRTask;
import water.MemoryManager;
import water.fvec.Chunk;
import water.fvec.Frame;
import water.fvec.NewChunk;
import water.util.ArrayUtils;

import static hex.genmodel.algos.gam.GamMojoModel.MS_SPLINE_TYPE;

/**
 * This task will gamified all gam predictors with bs=3.  It will not generate the penalty matrix or the Z matrix.  
 * Those are assumed to be generated already earlier.
 */
public class AddMSGamColumns extends MRTask {
  double[][][] _knotsMat; // knots without duplication for M-spline
  int[] _numKnots;
  int[] _numBasis;
  public int _numGAMCols; // count number of M-Spline gam columns
  int[] _gamColsOffsets;
  Frame _gamFrame;
  int[] _bs;              // for M-spline only
  int[] _splineOrder;     // for M-spline only
  int _totGamifiedCols=0;
  public int _totGamifiedColCentered=0;
  final double[][][] _ztransp;

  public AddMSGamColumns(double[][][] knotsMat, double[][][] ztransp, int[] numKnot, int[] bs, int[] splineOrder,
                         Frame gamColFrames) {
    _gamFrame = gamColFrames;
    _numGAMCols = gamColFrames.numCols();
    _gamColsOffsets = MemoryManager.malloc4(_numGAMCols);
    _knotsMat = new double[_numGAMCols][][];
    _bs = new int[_numGAMCols];
    _splineOrder = new int[_numGAMCols];
    _numKnots = new int[_numGAMCols];
    _numBasis = new int[_numGAMCols];
    _ztransp = new double[_numGAMCols][][];
    int totGamCols = bs.length;
    int countMS = 0;
    int offset = 0;
    for (int index=0; index




© 2015 - 2025 Weber Informatics LLC | Privacy Policy