001/**
002 * Test9.java
003 * jCOLIBRI2 framework. 
004 * @author Juan A. Recio-Garc´┐Ża.
005 * GAIA - Group for Artificial Intelligence Applications
006 * http://gaia.fdi.ucm.es
007 * 03/05/2007
008 */
009package es.ucm.fdi.gaia.jcolibri.test.test9;
010
011
012
013import org.apache.log4j.LogManager;
014
015import es.ucm.fdi.gaia.jcolibri.casebase.LinealCaseBase;
016import es.ucm.fdi.gaia.jcolibri.cbrcore.Attribute;
017import es.ucm.fdi.gaia.jcolibri.cbrcore.CBRCaseBase;
018import es.ucm.fdi.gaia.jcolibri.cbrcore.Connector;
019import es.ucm.fdi.gaia.jcolibri.connector.PlainTextConnector;
020import es.ucm.fdi.gaia.jcolibri.method.retrieve.NNretrieval.NNConfig;
021import es.ucm.fdi.gaia.jcolibri.method.retrieve.NNretrieval.similarity.global.Average;
022import es.ucm.fdi.gaia.jcolibri.method.retrieve.NNretrieval.similarity.local.Interval;
023
024/**
025 * This example shows how to visualizate a case base using the InfoVisual library develped by Josep Lluis Arcos (IIIA-CSIC).
026 * The class of each case is defined by the id attribute of the solution.
027 * @author Juan A. Recio-Garcia
028 *
029 */
030public class Test9 {
031
032        /**
033         * @param args
034         */
035        public static void main(String[] args) {
036                
037                try {
038                        es.ucm.fdi.gaia.jcolibri.util.ProgressController.clear();
039                        es.ucm.fdi.gaia.jcolibri.util.ProgressController.register(new es.ucm.fdi.gaia.jcolibri.test.main.SwingProgressBar(), es.ucm.fdi.gaia.jcolibri.extensions.visualization.CasesVisualization.class);
040                    
041                        //Configure connector and case base
042                        Connector _connector = new PlainTextConnector();
043                        _connector.initFromXMLfile(es.ucm.fdi.gaia.jcolibri.util.FileIO.findFile("es/ucm/fdi/gaia/jcolibri/test/test9/plaintextconfig.xml"));
044                        CBRCaseBase _caseBase  = new LinealCaseBase();
045                        
046                        // Load cases
047                        _caseBase.init(_connector);
048                        
049                        
050                        // Configure NN
051                        
052                        NNConfig simConfig = new NNConfig();
053                        simConfig.setDescriptionSimFunction(new Average());
054                        simConfig.addMapping(new Attribute("sepalLength",IrisDescription.class), new Interval(3.6));
055                        simConfig.addMapping(new Attribute("sepalWidth", IrisDescription.class), new Interval(2.4));
056                        simConfig.addMapping(new Attribute("petalLength",IrisDescription.class), new Interval(5.9));
057                        simConfig.addMapping(new Attribute("petalWidth", IrisDescription.class), new Interval(2.4));
058                        
059                        // Visualize the case base
060                        es.ucm.fdi.gaia.jcolibri.extensions.visualization.CasesVisualization.visualize(_caseBase.getCases(), simConfig);
061                        
062                } catch (Exception e) {
063                        LogManager.getLogger(Test9.class.getName()).error(e);
064                }
065
066
067        }
068
069}