public Result regress(DiscreteVariable x,List<Node> regressors){
  if (!binary(x)) {
    throw new IllegalArgumentException("Target must be binary.");
  }
  for (  Node node : regressors) {
    if (!(node instanceof ContinuousVariable || binary(node))) {
      throw new IllegalArgumentException("Regressors must be continuous or binary.");
    }
  }
  double[][] _regressors=new double[regressors.size()][getRows().length];
  for (int j=0; j < regressors.size(); j++) {
    int col=dataSet.getColumn(regressors.get(j));
    double[] dataCol=dataCols[col];
    for (int i=0; i < getRows().length; i++) {
      _regressors[j][i]=dataCol[getRows()[i]];
    }
  }
  int[] target=new int[getRows().length];
  int col=dataSet.getColumn(dataSet.getVariable(x.getName()));
  for (int i=0; i < getRows().length; i++) {
    target[i]=dataSet.getInt(getRows()[i],col);
  }
  List<String> regressorNames=new ArrayList<>();
  for (  Node node : regressors) {
    regressorNames.add(node.getName());
  }
  return regress(target,x.getName(),_regressors,regressorNames);
}

public Result regress ( DiscreteVariable x , List < Node > regressors ) { if ( ! binary ( x ) ) { throw new IllegalArgumentException ( "Target must be binary." ) ; } for ( Node node : regressors ) { if ( ! ( node instanceof ContinuousVariable || binary ( node ) ) ) { throw new IllegalArgumentException ( "Regressors must be continuous or binary." ) ; } } double [ ] [ ] _regressors = new double [ regressors . size ( ) ] [ getRows ( ) . length ] ; for ( int j = 0 ; j < regressors . size ( ) ; j ++ ) { int col = dataSet . getColumn ( regressors . get ( j ) ) ; double [ ] dataCol = dataCols [ col ] ; for ( int i = 0 ; i < getRows ( ) . length ; i ++ ) { _regressors [ j ] [ i ] = dataCol [ getRows ( ) [ i ] ] ; } } int [ ] target = new int [ getRows ( ) . length ] ; int col = dataSet . getColumn ( dataSet . getVariable ( x . getName ( ) ) ) ; for ( int i = 0 ; i < getRows ( ) . length ; i ++ ) { target [ i ] = dataSet . getInt ( getRows ( ) [ i ] , col ) ; } List < String > regressorNames = new ArrayList < > ( ) ; for ( Node node : regressors ) { regressorNames . add ( node . getName ( ) ) ; } return regress ( target , x . getName ( ) , _regressors , regressorNames ) ; }
x must be binary ; regressors must be continuous or binary .
