#-------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#
#-------------------------------------------------------------

X = read($1);
y = read($2);
numTrSamples = 100;
numValSamples = 100;

X_train = X[1:numTrSamples,];
y_train = y[1:numTrSamples,];
X_val = X[(numTrSamples+1):(numTrSamples+numValSamples+1),];
y_val = y[(numTrSamples+1):(numTrSamples+numValSamples+1),];
X_test = X[(numTrSamples+numValSamples+2):nrow(X),];
y_test = y[(numTrSamples+numValSamples+2):nrow(X),];

params = list("reg");
paramRanges = matrix("0 20", rows=1, cols=2);

[bestWeights, optHyperParams] = hyperband(X_train=X_train, y_train=y_train,
  X_val=X_val, y_val=y_val, params=params, paramRanges=paramRanges);

print(toString(optHyperParams))
