@@ -0,0 +1,2574 @@
+/*******************************************************************************%0A * DIANNE  - Framework for distributed artificial neural networks%0A * Copyright (C) 2015  iMinds - IBCN - UGent%0A *%0A * This file is part of DIANNE.%0A *%0A * DIANNE is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU Affero General Public License as%0A * published by the Free Software Foundation, either version 3 of the%0A * License, or (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU Affero General Public License for more details.%0A *%0A * You should have received a copy of the GNU Affero General Public License%0A * along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A *%0A * Contributors:%0A *     Tim Verbelen, Steven Bohez%0A *******************************************************************************/%0Apackage be.iminds.iot.dianne.dataset.adapters;%0A%0Aimport java.util.Map;%0A%0Aimport org.osgi.service.component.annotations.Activate;%0Aimport org.osgi.service.component.annotations.Component;%0Aimport org.osgi.service.component.annotations.ConfigurationPolicy;%0Aimport org.osgi.service.component.annotations.Reference;%0A%0Aimport be.iminds.iot.dianne.api.dataset.Dataset;%0Aimport be.iminds.iot.dianne.tensor.Tensor;%0A%0A/**%0A * This Dataset adapter will set the target output the same as the input.%0A * %0A * Can be used to train AutoEncoders on an existing (classification) Dataset%0A * %0A * @author tverbele%0A *%0A */%0A@Component(configurationPolicy=ConfigurationPolicy.REQUIRE,%0A%09configurationPid=%22be.iminds.iot.dianne.dataset.adapters.AutoencoderAdapter%22)%0Apublic class DatasetAutoencoderAdapter implements Dataset %7B%0A%0A%09private Dataset data;%0A%09private String name;%0A%0A%09@Reference%0A%09void setDataset(Dataset d)%7B%0A%09%09this.data = d;%0A%09%7D%0A%09%0A%09@Activate%0A%09void activate(Map%3CString, Object%3E properties) %7B%0A%09%09this.name = (String)properties.get(%22name%22);%0A%09%7D%0A%09%0A%09@Override%0A%09public String getName()%7B%0A%09%09return name;%0A%09%7D%0A%09%0A%09@Override%0A%09public int%5B%5D inputDims()%7B%0A%09%09return data.inputDims();%0A%09%7D%0A%09%0A%09@Override%0A%09public int%5B%5D outputDims()%7B%0A%09%09return data.inputDims();%0A%09%7D%0A%09%0A%09@Override%0A%09public int size() %7B%0A%09%09return data.size();%0A%09%7D%0A%0A%09@Override%0A%09public Tensor getInputSample(Tensor t, int index) %7B%0A%09%09return data.getInputSample(t, index);%0A%09%7D%0A%0A%09@Override%0A%09public Tensor getOutputSample(Tensor t, int index) %7B%0A%09%09return data.getInputSample(t, index);%0A%09%7D%0A%09%0A%09@Override%0A%09public String%5B%5D getLabels()%7B%0A%09%09return null;%0A%09%7D%0A%0A%7D%0A

add Dataset adapter for training AutoEncoders