Skip to content
Snippets Groups Projects
Commit a8a96c3f authored by Matias Mennecart's avatar Matias Mennecart
Browse files

Ajouts classfication des points

parent c7d4c0cb
Branches
Tags
No related merge requests found
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<children> <children>
<Button fx:id="loadData" mnemonicParsing="false" onAction="#openLoadData" prefHeight="27.0" prefWidth="185.0" text="Charger un jeu de données" /> <Button fx:id="loadData" mnemonicParsing="false" onAction="#openLoadData" prefHeight="27.0" prefWidth="185.0" text="Charger un jeu de données" />
<Button fx:id="addData" mnemonicParsing="false" onAction="#openAddData" prefHeight="26.0" prefWidth="141.0" text="Ajouter une donnée" /> <Button fx:id="addData" mnemonicParsing="false" onAction="#openAddData" prefHeight="26.0" prefWidth="141.0" text="Ajouter une donnée" />
<Button fx:id="classifyData" disable="true" mnemonicParsing="false" prefHeight="26.0" prefWidth="157.0" text="Classifier une donnée" /> <Button fx:id="classifyData" disable="true" mnemonicParsing="false" onAction="#classifyDatas" prefHeight="26.0" prefWidth="157.0" text="Classifier les données" />
</children> </children>
</HBox> </HBox>
</children> </children>
......
...@@ -56,6 +56,7 @@ public class AddDataController { ...@@ -56,6 +56,7 @@ public class AddDataController {
public void validate() throws IOException { public void validate() throws IOException {
System.out.println("validé"); System.out.println("validé");
mainStageView.getController().getClassifyData().setDisable(false);
ClassificationModel.getClassificationModel().ajouterDonnee(sepalLengthSpinner.getValue(), sepalWidthSpinner.getValue(), petalLengthSpinner.getValue(), petalWidthSpinner.getValue()); ClassificationModel.getClassificationModel().ajouterDonnee(sepalLengthSpinner.getValue(), sepalWidthSpinner.getValue(), petalLengthSpinner.getValue(), petalWidthSpinner.getValue());
stage.close(); stage.close();
} }
......
...@@ -81,6 +81,12 @@ public class MainStageController { ...@@ -81,6 +81,12 @@ public class MainStageController {
} }
public void classifyDatas() {
ClassificationModel.getClassificationModel().classifierDonnees();
}
public ScatterChart getScatterChart() { public ScatterChart getScatterChart() {
return this.scatterChart; return this.scatterChart;
} }
...@@ -88,4 +94,8 @@ public class MainStageController { ...@@ -88,4 +94,8 @@ public class MainStageController {
public void setAxesSelected(String texte) { public void setAxesSelected(String texte) {
this.AxesSelected.setText(texte); this.AxesSelected.setText(texte);
} }
public Button getClassifyData() {
return this.classifyData;
}
} }
...@@ -75,11 +75,16 @@ public class ClassificationModel extends Observable { ...@@ -75,11 +75,16 @@ public class ClassificationModel extends Observable {
notifyObservers(); notifyObservers();
} }
public void classifierDonnees() {
dataToClass.forEach(this::classifierDonnee);
}
/** /**
* TODO * TODO
* @param data * @param data
*/ */
public void classifierDonnee(LoadableData data) { private void classifierDonnee(LoadableData data) {
List<String> classes = new ArrayList<>(data.getClassificationTypes()); List<String> classes = new ArrayList<>(data.getClassificationTypes());
Random rdm = new Random(); Random rdm = new Random();
......
...@@ -26,6 +26,16 @@ public class Iris extends LoadableData{ ...@@ -26,6 +26,16 @@ public class Iris extends LoadableData{
// //
} }
@Override
public String getClassification() {
return variety;
}
@Override
public void setClassification(String classification) {
this.variety = classification;
}
public Iris(double sepalWidth, double sepalLength, double petalWidth, double petalLength, String variety) { public Iris(double sepalWidth, double sepalLength, double petalWidth, double petalLength, String variety) {
super(); super();
this.sepalWidth = sepalWidth; this.sepalWidth = sepalWidth;
...@@ -51,9 +61,6 @@ public class Iris extends LoadableData{ ...@@ -51,9 +61,6 @@ public class Iris extends LoadableData{
return petalLength; return petalLength;
} }
public String getVariety() {
return variety;
}
public double getDataType(String axes){ public double getDataType(String axes){
switch (axes){ switch (axes){
......
...@@ -6,7 +6,8 @@ public abstract class LoadableData { ...@@ -6,7 +6,8 @@ public abstract class LoadableData {
private static Set<String> classificationTypes; private static Set<String> classificationTypes;
private String classification;
protected LoadableData() { protected LoadableData() {
...@@ -16,9 +17,7 @@ public abstract class LoadableData { ...@@ -16,9 +17,7 @@ public abstract class LoadableData {
this.classificationTypes.add(classificationType); this.classificationTypes.add(classificationType);
} }
public String getClassification() { public abstract String getClassification() ;
return this.classification;
}
public static Set<String> getClassificationTypes() { public static Set<String> getClassificationTypes() {
return classificationTypes; return classificationTypes;
...@@ -28,9 +27,7 @@ public abstract class LoadableData { ...@@ -28,9 +27,7 @@ public abstract class LoadableData {
LoadableData.classificationTypes = classificationTypes; LoadableData.classificationTypes = classificationTypes;
} }
public void setClassification(String classification) { public abstract void setClassification(String classification);
this.classification = classification;
}
public abstract String[] getAttributesName(); public abstract String[] getAttributesName();
......
...@@ -42,6 +42,7 @@ public class AddDataView { ...@@ -42,6 +42,7 @@ public class AddDataView {
controller.setMainStageView(mainStageView); controller.setMainStageView(mainStageView);
if(model.getDatas().isEmpty()) { if(model.getDatas().isEmpty()) {
Alert alert = new Alert(Alert.AlertType.WARNING); Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("Erreur"); alert.setTitle("Erreur");
......
...@@ -128,4 +128,8 @@ public class MainStageView implements Observer { ...@@ -128,4 +128,8 @@ public class MainStageView implements Observer {
return actualY; return actualY;
} }
public MainStageController getController() {
return controller;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment