@@ -0,0 +1,1592 @@
+// Copyright 2015 Georg-August-Universit%C3%A4t G%C3%B6ttingen, Germany%0A//%0A//   Licensed under the Apache License, Version 2.0 (the %22License%22);%0A//   you may not use this file except in compliance with the License.%0A//   You may obtain a copy of the License at%0A//%0A//       http://www.apache.org/licenses/LICENSE-2.0%0A//%0A//   Unless required by applicable law or agreed to in writing, software%0A//   distributed under the License is distributed on an %22AS IS%22 BASIS,%0A//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A//   See the License for the specific language governing permissions and%0A//   limitations under the License.%0A%0Apackage de.ugoe.cs.cpdp.wekaclassifier;%0A%0Aimport java.lang.reflect.Field;%0A%0Aimport org.apache.commons.lang3.reflect.FieldUtils;%0A%0Aimport weka.classifiers.sklearn.ScikitLearnClassifier;%0Aimport weka.core.Instances;%0A%0A/**%0A * %3Cp%3E%0A * Wrapper to always remove the model from Python after training to prevent memory leakages.%0A * %3C/p%3E%0A *%0A * @author Steffen Tunkel%0A */%0Apublic class SklearnWrapper extends ScikitLearnClassifier %7B%0A%0A    /** Default serial ID */%0A    private static final long serialVersionUID = 1L;%0A%0A    /*%0A     * (non-Javadoc)%0A     *%0A     * @see weka.classifiers.bayes.BayesNet#buildClassifier(weka.core.Instances)%0A     */%0A    @SuppressWarnings(%22boxing%22)%0A    @Override%0A    public void buildClassifier(Instances traindata) throws Exception %7B%0A        Field f1 = this.m_learner.getClass().getDeclaredField(%22m_removeModelFromPyPostTraining%22);%0A        FieldUtils.writeField(f1, this.m_learner, true, true);%0A        super.buildClassifier(traindata);%0A    %7D%0A%7D%0A

add sklearn wrapper to fix memory leakage