You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Aykut Çayır <ay...@gmail.com> on 2015/05/17 23:07:38 UTC
I have a weird exception in Online logistic regression
Hi mahouters,
I have tried to implement an application to classify Breast caner using
wisconsin dataset (UCI). However, I have An exception Array out bounds
exception dene Vector setQuick method. Can anyone help me? Thanks
Re: I have a weird exception in Online logistic regression
Posted by Aykut Çayır <ay...@gmail.com>.
Data Sample:
1000025,5,1,1,1,2,1,3,1,1,2
1002945,5,4,4,5,7,10,3,2,1,2
1015425,3,1,1,1,2,2,3,1,1,2
1016277,6,8,8,1,3,4,3,7,1,2
1017023,4,1,1,3,2,1,3,1,1,2
1017122,8,10,10,8,7,10,9,7,1,4
1018099,1,1,1,1,2,10,3,1,1,2
1018561,2,1,2,1,2,1,3,1,1,2
1033078,2,1,1,1,2,1,1,1,5,2
1033078,4,2,1,1,2,1,2,1,1,2
1035283,1,1,1,1,1,1,3,1,1,2
1036172,2,1,1,1,2,1,2,1,1,2
1041801,5,3,3,3,2,3,4,4,1,4
1043999,1,1,1,1,2,3,3,1,1,2
1044572,8,7,5,10,7,9,5,5,4,4
1047630,7,4,6,4,6,1,4,3,1,4
---------------------------------------------
private static OnlineLogisticRegression olr;
public static void loadDataSet(File file, ArrayList<Vector> dataset,
ArrayList<Integer> labels) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(file));
String line = null;
while ((line = reader.readLine()) != null) {
String[] vals = line.split(",");
int label = Integer.parseInt(vals[10]);
Vector dv = new DenseVector(10);
dv.set(0, 1);
for (int i = 1; i <= 9; i++)
dv.set(i, Double.parseDouble(vals[i]));
// System.out.println(feats.length);
dataset.add(dv);
labels.add(label);
}
if (reader != null) {
reader.close();
}
}
public static void main(String[] args) throws IOException {
ArrayList<Vector> ds = new ArrayList<Vector>();
ArrayList<Integer> targets = new ArrayList<Integer>();
loadDataSet(
new File(
"/home/aykut/Desktop/datasets/breastCancer/breast-cancer-wisconsin.data"),
ds, targets);
//int size = ds.size();
//System.out.println(targets.size());
for (int execution = 1; execution <= 200; execution++) {
olr = new OnlineLogisticRegression(2, 10, new L2(1));
for (int iter = 0; iter < 30; iter++) {
for (int i = 0; i < 600; i++) {
olr.train(targets.get(i).intValue(), ds.get(i)); // I
got the exception in this line??
// System.out.println(targets.get(i));
}
}
}
--------------------------------------------------------------
Thanks.
2015-05-18 0:15 GMT+03:00 Andrew Musselman <an...@gmail.com>:
> Could you post your code and some sample data?
>
> On Sunday, May 17, 2015, Aykut Çayır <ay...@gmail.com> wrote:
>
> > Hi mahouters,
> > I have tried to implement an application to classify Breast caner using
> > wisconsin dataset (UCI). However, I have An exception Array out bounds
> > exception dene Vector setQuick method. Can anyone help me? Thanks
> >
>
Re: I have a weird exception in Online logistic regression
Posted by Andrew Musselman <an...@gmail.com>.
Could you post your code and some sample data?
On Sunday, May 17, 2015, Aykut Çayır <ay...@gmail.com> wrote:
> Hi mahouters,
> I have tried to implement an application to classify Breast caner using
> wisconsin dataset (UCI). However, I have An exception Array out bounds
> exception dene Vector setQuick method. Can anyone help me? Thanks
>