1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
/*********************************************************************
MLDemos: A User-Friendly visualization toolkit for machine learning
Copyright (C) 2010 Basilio Noris
Contact: mldemos@b4silio.com
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License,
version 3 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*********************************************************************/
#ifndef _INTERFACEEXAMPLEREGRESS_H_
#define _INTERFACEEXAMPLEREGRESS_H_
#include <vector>
#include <interfaces.h>
#include "regressorExample.h"
#include "ui_paramsExample.h"
/**
Example of plugin interface for a regression algorithm
*/
class RegrExample : public QObject, public RegressorInterface
{
Q_OBJECT
Q_INTERFACES(RegressorInterface)
private:
QWidget *widget; // the widget that will hold the hyperparameter panel
Ui::ParametersExample *params; // the hyperparameter panel (instantiated from the ui form)
public:
/*!
Constructor, it instantiates the widget and parameter panel
*/
RegrExample();
/*!
The function called by the main program to obtain the clusterer.
It should generate the clusterer and set its parameter to match the user choice.
*/
Regressor *GetRegressor();
/*!
The function called by the main program to draw the learned model (e.g. the classified samples)
*/
void DrawInfo(Canvas *canvas, QPainter &painter, Regressor *regressor);
/*!
The function called by the main program to draw the model information
(e.g. the projection axes, cluster centers or class boundaries, if these are available)
*/
void DrawModel(Canvas *canvas, QPainter &painter, Regressor *regressor);
/*!
The function called by the main program to draw the model confidence (when available)
*/
void DrawConfidence(Canvas *canvas, Regressor *regressor);
/*!
Function that returns the name of the algorithm (will appear in the algorithm options panel tab)
*/
QString GetName(){return QString("Example");}
/*!
The unique string describing the algorithm and options currently used (displayed in the Compare panel)
*/
QString GetAlgoString();
/*!
Link to the html page containing a description of the algorithm and/or implementation details
*/
QString GetInfoFile(){return "Example.html";}
/*!
Returns the option widget, used by the main program to get the hyperparameter panel
*/
QWidget *GetParameterWidget(){return widget;}
/*!
Sets the parameter for the classifier
*/
void SetParams(Regressor *regressor);
/*!
Saves the hyperparameter options to the system's registry
*/
void SaveOptions(QSettings &settings);
/*!
Loads the hyperparameter options from the system's registry
*/
bool LoadOptions(QSettings &settings);
/*!
Saves the parameter to file (or to string for the compare dialog)
*/
void SaveParams(QTextStream &stream);
/*!
Loads the parameter from file (or from string for the compare dialog)
*/
bool LoadParams(QString name, float value);
};
#endif // _INTERFACEEXAMPLEREGRESS_H_
|