private void buildLinearModel(int[] indices) throws Exception {
  Instances reducedInst=new Instances(m_instances);
  Remove attributeFilter=new Remove();
  attributeFilter.setInvertSelection(true);
  attributeFilter.setAttributeIndicesArray(indices);
  attributeFilter.setInputFormat(reducedInst);
  reducedInst=Filter.useFilter(reducedInst,attributeFilter);
  LinearRegression temp=new LinearRegression();
  temp.buildClassifier(reducedInst);
  double[] lmCoeffs=temp.coefficients();
  double[] coeffs=new double[m_instances.numAttributes()];
  for (int i=0; i < lmCoeffs.length - 1; i++) {
    if (indices[i] != m_classIndex) {
      coeffs[indices[i]]=lmCoeffs[i];
    }
  }
  m_nodeModel=new PreConstructedLinearModel(coeffs,lmCoeffs[lmCoeffs.length - 1]);
  m_nodeModel.buildClassifier(m_instances);
}

private void buildLinearModel ( int [ ] indices ) throws Exception { Instances reducedInst = new Instances ( m_instances ) ; Remove attributeFilter = new Remove ( ) ; attributeFilter . setInvertSelection ( true ) ; attributeFilter . setAttributeIndicesArray ( indices ) ; attributeFilter . setInputFormat ( reducedInst ) ; reducedInst = Filter . useFilter ( reducedInst , attributeFilter ) ; LinearRegression temp = new LinearRegression ( ) ; temp . buildClassifier ( reducedInst ) ; double [ ] lmCoeffs = temp . coefficients ( ) ; double [ ] coeffs = new double [ m_instances . numAttributes ( ) ] ; for ( int i = 0 ; i < lmCoeffs . length - 1 ; i ++ ) { if ( indices [ i ] != m_classIndex ) { coeffs [ indices [ i ] ] = lmCoeffs [ i ] ; } } m_nodeModel = new PreConstructedLinearModel ( coeffs , lmCoeffs [ lmCoeffs . length - 1 ] ) ; m_nodeModel . buildClassifier ( m_instances ) ; }
build a linear model for this node using those attributes specified in indices .
