Skip to content

Commit 1501314

Browse files
Final
1 parent eb5feb3 commit 1501314

File tree

6 files changed

+10
-14
lines changed

6 files changed

+10
-14
lines changed

ProjetoAMC/src/Classifier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public int classify(int[] amostra) {
4343
erro = true;
4444
}
4545
}
46-
//System.out.println(odds.toString());
46+
//System.out.println(odds.toString()); // para ver probabilidades ao correr testes
4747
if (erro) return r;
4848
else { throw new AssertionError("Erro");}
4949
}

ProjetoAMC/src/Dataset.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
public class Dataset implements Serializable{
66
//default serialVersion id
7-
private static final long serialVersionUID = 1L;
7+
private static final long serialVersionUID = 1L;
88

99
protected ArrayList<int[]> data; // lista de amostras (dados)
1010
private int n; // numero de variaveis aleatorias, o java comeca a contar do 0

ProjetoAMC/src/JanelaAprendizagem.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public ArrayList<MRFTree> ChowLiu(Dataset ds) {
9191
return mrftList;
9292

9393
}
94-
//TODO delete?
94+
9595
public void testes_old(Dataset ds, Classifier classificador, int limit) {
9696
System.out.println(classificador);
9797

@@ -106,9 +106,9 @@ public void testes_old(Dataset ds, Classifier classificador, int limit) {
106106
if (result) rtests++;
107107
System.out.println("" + result + ", expected = " + expected + ", predicted = " + predicted);
108108
}
109-
System.out.println("Finished. " + rtests + "/" + Math.min(limit, ds.getData().size()));
109+
System.out.println("Finished. " + rtests + "/" + Math.min(limit, ds.getData().size()) + "=" + rtests*100/Math.min(limit, ds.getData().size()));
110110
}
111-
//TODO delete?
111+
112112
public void testes(Dataset ds, int limit) {
113113
System.out.println("Beginning tests...");
114114
int rtests = 0;
@@ -132,9 +132,8 @@ public void testes(Dataset ds, int limit) {
132132

133133
ds.Add(sample);
134134
}
135-
136-
System.out.println("Finished. " + rtests + "/" + Math.min(limit, ds.getData().size()));
137-
}
135+
System.out.println("Finished. " + rtests + "/" + Math.min(limit, ds.getData().size()) + " = " + Double.valueOf(rtests)*100/Double.valueOf(Math.min(limit, ds.getData().size())) + "%");
136+
}
138137

139138
// Initialize the contents of the frame.
140139

@@ -205,7 +204,7 @@ public void mouseClicked(MouseEvent e) {
205204

206205
Classifier classificador = new Classifier(mrftList, ds.Freqlist);
207206

208-
lblStatus.setText(lblStatus.getText().substring(0, lblStatus.getText().length()-7) + "Saving the model </html>");
207+
lblStatus.setText(lblStatus.getText().substring(0, lblStatus.getText().length()-7) + "Saving the model. </html>");
209208

210209
String savePath = txtSavePath.getText();
211210

@@ -258,7 +257,6 @@ public void mouseClicked(MouseEvent e) {
258257

259258
txtDsPath.setBounds(48, 43, 253, 26);
260259
frmJanelaAprendizagem.getContentPane().add(txtDsPath);
261-
//txtDsPath.setText("/Users/miguelfernandes/Documents/GitHub/amc/Datasets2021/bcancer.csv"); // TODO comentar e apagar no fim
262260
txtDsPath.setColumns(10);
263261

264262
JLabel lblNewLabel = new JLabel("Dataset path");
@@ -281,7 +279,6 @@ public void mouseClicked(MouseEvent e) {
281279
});
282280
txtSavePath.setBounds(48, 109, 253, 26);
283281
frmJanelaAprendizagem.getContentPane().add(txtSavePath);
284-
//txtSavePath.setText("/Users/miguelfernandes/Documents/GitHub/amc/Models2021/bcancer.ser"); // TODO comentar e apagar no fim
285282
txtSavePath.setColumns(10);
286283

287284
JLabel lblNewLabel_1 = new JLabel("Save path for the model");

ProjetoAMC/src/JanelaClassificador.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ public void mouseClicked(MouseEvent e) {
9898
// e necessario usar um cast (Classifier) para definir qual vai ser a classe do objeto que vai ser lido
9999
classificador = (Classifier) objectIn.readObject();
100100

101-
//System.out.println("The Classifier model has been read from the file");
102101
lblModelStatus.setText("Model loaded!");
103102

104103
objectIn.close();

ProjetoAMC/src/WeightedGraph.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class WeightedGraph { // grafo pesado
66
private int dim;
77
private double[][] ma;
88

9-
public WeightedGraph(int dim) { // metodo construtor
9+
public WeightedGraph(int dim) {
1010
this.dim = dim;
1111
this.ma = new double[dim][dim];
1212

@@ -120,7 +120,7 @@ public Tree MST(int r) { // determina a MST com o Algoritmo de Prim,
120120
// metodo auxiliar para o metodo MST
121121
public int ExtractMin(Queue<Integer> Q, double[] C) {
122122
double min = Double.POSITIVE_INFINITY;
123-
int r = 0; // o java obriga a que a variavel seja iniciada
123+
int r = 0;
124124
for (int i : Q) {
125125
if (C[i] < min) {
126126
min = C[i];

Relatório.pdf

1.14 MB
Binary file not shown.

0 commit comments

Comments
 (0)