Ignore:
Timestamp:
09/24/15 10:59:05 (9 years ago)
Author:
sherbold
Message:
  • formatted code and added copyrights
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrossPare/src/de/ugoe/cs/cpdp/wekaclassifier/FixClass.java

    r30 r41  
     1// Copyright 2015 Georg-August-Universität Göttingen, Germany 
     2// 
     3//   Licensed under the Apache License, Version 2.0 (the "License"); 
     4//   you may not use this file except in compliance with the License. 
     5//   You may obtain a copy of the License at 
     6// 
     7//       http://www.apache.org/licenses/LICENSE-2.0 
     8// 
     9//   Unless required by applicable law or agreed to in writing, software 
     10//   distributed under the License is distributed on an "AS IS" BASIS, 
     11//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
     12//   See the License for the specific language governing permissions and 
     13//   limitations under the License. 
     14 
    115package de.ugoe.cs.cpdp.wekaclassifier; 
    2  
    316 
    417import weka.classifiers.AbstractClassifier; 
     
    1629public class FixClass extends AbstractClassifier { 
    1730 
    18         private static final long serialVersionUID = 1L; 
     31    private static final long serialVersionUID = 1L; 
    1932 
    20         private double fixedClassValue = 0.0d; 
     33    private double fixedClassValue = 0.0d; 
    2134 
    22         public FixClass() { 
    23                 // TODO Auto-generated constructor stub 
    24         } 
     35    public FixClass() { 
     36        // TODO Auto-generated constructor stub 
     37    } 
    2538 
    26         /** 
    27         * Returns default capabilities of the classifier. 
    28         *  
    29         * @return the capabilities of this classifier 
    30         */ 
    31         @Override 
    32         public Capabilities getCapabilities() { 
    33                 Capabilities result = super.getCapabilities(); 
    34                 result.disableAll(); 
     39    /** 
     40    * Returns default capabilities of the classifier. 
     41    *  
     42    * @return the capabilities of this classifier 
     43    */ 
     44    @Override 
     45    public Capabilities getCapabilities() { 
     46        Capabilities result = super.getCapabilities(); 
     47        result.disableAll(); 
    3548 
    36                 // attributes 
    37                 result.enable(Capability.NOMINAL_ATTRIBUTES); 
    38                 result.enable(Capability.NUMERIC_ATTRIBUTES); 
    39                 result.enable(Capability.DATE_ATTRIBUTES); 
    40                 result.enable(Capability.STRING_ATTRIBUTES); 
    41                 result.enable(Capability.RELATIONAL_ATTRIBUTES); 
    42                 result.enable(Capability.MISSING_VALUES); 
     49        // attributes 
     50        result.enable(Capability.NOMINAL_ATTRIBUTES); 
     51        result.enable(Capability.NUMERIC_ATTRIBUTES); 
     52        result.enable(Capability.DATE_ATTRIBUTES); 
     53        result.enable(Capability.STRING_ATTRIBUTES); 
     54        result.enable(Capability.RELATIONAL_ATTRIBUTES); 
     55        result.enable(Capability.MISSING_VALUES); 
    4356 
    44                 // class 
    45                 result.enable(Capability.NOMINAL_CLASS); 
    46                 result.enable(Capability.NUMERIC_CLASS); 
    47                 result.enable(Capability.MISSING_CLASS_VALUES); 
     57        // class 
     58        result.enable(Capability.NOMINAL_CLASS); 
     59        result.enable(Capability.NUMERIC_CLASS); 
     60        result.enable(Capability.MISSING_CLASS_VALUES); 
    4861 
    49                 // instances 
    50                 result.setMinimumNumberInstances(0); 
     62        // instances 
     63        result.setMinimumNumberInstances(0); 
    5164 
    52                 return result; 
    53         } 
     65        return result; 
     66    } 
    5467 
    55         @Override 
    56         public void setOptions(String[] options) throws Exception { 
    57                 fixedClassValue = Double.parseDouble(Utils.getOption('C', options)); 
    58         } 
     68    @Override 
     69    public void setOptions(String[] options) throws Exception { 
     70        fixedClassValue = Double.parseDouble(Utils.getOption('C', options)); 
     71    } 
    5972 
    60         @Override 
    61         public double classifyInstance(Instance instance) { 
    62                 return fixedClassValue; 
    63         } 
     73    @Override 
     74    public double classifyInstance(Instance instance) { 
     75        return fixedClassValue; 
     76    } 
    6477 
    65         @Override 
    66         public void buildClassifier(Instances traindata) throws Exception { 
    67                 // do nothing 
    68         } 
     78    @Override 
     79    public void buildClassifier(Instances traindata) throws Exception { 
     80        // do nothing 
     81    } 
    6982} 
Note: See TracChangeset for help on using the changeset viewer.