public class ScikitLearnClusterer
extends weka.clusterers.AbstractClusterer
implements weka.core.BatchPredictor
| Modifier and Type | Class and Description |
|---|---|
static class |
ScikitLearnClusterer.Clusterer
Holds info on the different learners available
|
| Modifier and Type | Field and Description |
|---|---|
static weka.core.Tag[] |
TAGS_LEARNER
The tags for the GUI drop-down for learner selection
|
| Constructor and Description |
|---|
ScikitLearnClusterer() |
| Modifier and Type | Method and Description |
|---|---|
void |
buildClusterer(weka.core.Instances data)
Build the clusterer
|
double[] |
distributionForInstance(weka.core.Instance inst)
Return the predicted cluster memberships for the supplied instance
|
double[][] |
distributionsForInstances(weka.core.Instances insts)
Return the predicted cluster memberships for the supplied instances
|
java.lang.String |
getBatchSize() |
weka.core.Capabilities |
getCapabilities()
Get the capabilities of this learner
|
weka.core.SelectedTag |
getClusterer() |
boolean |
getContinueOnSysErr()
Get whether to try and continue after seeing output on the sys error
stream.
|
java.lang.String |
getLearnerOpts()
Get the parameters to pass to the scikit-learn scheme
|
java.lang.String |
getPythonCommand()
Get the python command to use.
|
java.lang.String |
getPythonPath()
Get optional entries to prepend to the PATH so that python can execute
correctly.
|
java.lang.String |
getServerID()
Get an optional server name by which to identify the python server to use.
|
java.lang.String |
globalInfo()
Global help info
|
boolean |
implementsMoreEfficientBatchPrediction()
Return true as we send entire test sets over to python for prediction
|
static void |
main(java.lang.String[] args)
Main method for testing this class
|
int |
numberOfClusters() |
void |
setBatchSize(java.lang.String size) |
void |
setClusterer(weka.core.SelectedTag learner)
Set the scikit-learn clustering scheme to use
|
void |
setContinueOnSysErr(boolean c)
Set whether to try and continue after seeing output on the sys error
stream.
|
void |
setLearnerOpts(java.lang.String opts)
Set the parameters to pass to the scikit-learn scheme
|
void |
setPythonCommand(java.lang.String pyCommand)
Set the python command to use.
|
void |
setPythonPath(java.lang.String pythonPath)
Set optional entries to prepend to the PATH so that python can execute
correctly.
|
void |
setServerID(java.lang.String serverID)
Set an optional server name by which to identify the python server to use.
|
java.lang.String |
toString()
Get a textual description of this scheme
|
clusterInstance, debugTipText, doNotCheckCapabilitiesTipText, forName, getDebug, getDoNotCheckCapabilities, getOptions, getRevision, listOptions, makeCopies, makeCopy, postExecution, preExecution, run, runClusterer, setDebug, setDoNotCheckCapabilities, setOptionspublic static final weka.core.Tag[] TAGS_LEARNER
public java.lang.String globalInfo()
public weka.core.Capabilities getCapabilities()
getCapabilities in interface weka.clusterers.ClusterergetCapabilities in interface weka.core.CapabilitiesHandlergetCapabilities in class weka.clusterers.AbstractClusterer@OptionMetadata(displayName="Scikit-learn clusterer",
description="Scikit-learn clusterer to use.\nAvailable clusterers:\nAffinityPropagation, KMeans, DBSCAN",
commandLineParamName="clusterer",
commandLineParamSynopsis="-clusterer <clusterer name>",
displayOrder=1)
public weka.core.SelectedTag getClusterer()
public void setClusterer(weka.core.SelectedTag learner)
learner - the scikit-learn clustering scheme to use@OptionMetadata(displayName="Learner parameters",
description="learner parameters to use",
displayOrder=2,
commandLineParamName="parameters",
commandLineParamSynopsis="-parameters <comma-separated list of name=value pairs>")
public java.lang.String getLearnerOpts()
public void setLearnerOpts(java.lang.String opts)
opts - the parameters to usepublic void setBatchSize(java.lang.String size)
setBatchSize in interface weka.core.BatchPredictor@OptionMetadata(displayName="Batch size",
description="The preferred number of instances to transfer into python for prediction\n(if operatingin batch prediction mode). More or fewer instances than this will be accepted.",
commandLineParamName="batch",
commandLineParamSynopsis="-batch <batch size>",
displayOrder=4)
public java.lang.String getBatchSize()
getBatchSize in interface weka.core.BatchPredictorpublic boolean implementsMoreEfficientBatchPrediction()
implementsMoreEfficientBatchPrediction in interface weka.core.BatchPredictorpublic void setContinueOnSysErr(boolean c)
c - true if we should try to continue after seeing output on the sys
error stream@OptionMetadata(displayName="Try to continue after sys err output from script",
description="Try to continue after sys err output from script.\nSome schemesreport warnings to the system error stream.",
displayOrder=5,
commandLineParamName="continue-on-err",
commandLineParamSynopsis="-continue-on-err",
commandLineParamIsFlag=true)
public boolean getContinueOnSysErr()
public void setPythonCommand(java.lang.String pyCommand)
pyCommand - the path to the python executable (or empty
string/"default" to use python in the PATH)@OptionMetadata(displayName="Python command ",
description="Path to python executable (\'default\' to use python in the PATH)",
commandLineParamName="py-command",
commandLineParamSynopsis="-py-command <path to python executable>",
displayOrder=7)
public java.lang.String getPythonCommand()
public void setPythonPath(java.lang.String pythonPath)
pythonPath - additional entries to prepend to the PATH@OptionMetadata(displayName="Python path",
description="Optional elements to prepend to the PATH so that python can execute correctly (\'default\' to use PATH as-is)",
commandLineParamName="py-path",
commandLineParamSynopsis="-py-path <path>",
displayOrder=8)
public java.lang.String getPythonPath()
public void setServerID(java.lang.String serverID)
serverID - the name of the server to use (or none for no specific
server name).@OptionMetadata(displayName="Server name/ID",
description="Optional name to identify this server, can be used to share a given server instance - default = \'none\' (i.e. no server name)",
commandLineParamName="server-name",
commandLineParamSynopsis="-server-name <server name | none>",
displayOrder=9)
public java.lang.String getServerID()
public void buildClusterer(weka.core.Instances data)
throws java.lang.Exception
buildClusterer in interface weka.clusterers.ClustererbuildClusterer in class weka.clusterers.AbstractClustererdata - set of instances serving as training datajava.lang.Exception - if a problem occurspublic int numberOfClusters()
throws java.lang.Exception
numberOfClusters in interface weka.clusterers.ClusterernumberOfClusters in class weka.clusterers.AbstractClustererjava.lang.Exceptionpublic double[][] distributionsForInstances(weka.core.Instances insts)
throws java.lang.Exception
distributionsForInstances in interface weka.core.BatchPredictorinsts - the instances to get predictions forjava.lang.Exception - if a problem occurspublic double[] distributionForInstance(weka.core.Instance inst)
throws java.lang.Exception
distributionForInstance in interface weka.clusterers.ClustererdistributionForInstance in class weka.clusterers.AbstractClustererinst - the instance to be classifiedjava.lang.Exception - if a problem occurspublic java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
args - command line args