public static string DecisionResult(Mahasiswa mahasiswa, int rows) // Hasil dari Decision tree Ya atau Tidak { logForm.addText("------------------------Row " + (rows + 1) + "--------------------\n", Color.LightBlue); CheckConnection(); Rumus.SearchAllGain(); AtributMahasiswa = new List <string>(); for (int i = 0; i < Rumus.coloumAndGain.Count; i++) { if (Rumus.coloumAndGain[i].Coloum == "Jenis_beasiswa") { AtributMahasiswa.Add(mahasiswa.Jenis_beasiswa); } else if (Rumus.coloumAndGain[i].Coloum == "ipk") { AtributMahasiswa.Add(mahasiswa.ipk); } else if (Rumus.coloumAndGain[i].Coloum == "Aktif_Organisasi") { AtributMahasiswa.Add(mahasiswa.aktif_organisasi); } else if (Rumus.coloumAndGain[i].Coloum == "Financial") { AtributMahasiswa.Add(mahasiswa.Financial); } else if (Rumus.coloumAndGain[i].Coloum == "Prestasi") { AtributMahasiswa.Add(mahasiswa.prestasi); } } mahasiswa.diterima = MakeTree.Tree(0, 0); return(mahasiswa.diterima); }
public void ValueView() { int[] temp; tree.ExpandAll(); Rumus.SearchAllGain(); for (int i = 0; i < 5; i++) { tree.Nodes[0].Nodes[i].Text = SetText(Rumus.coloumAndGain[i].Coloum, Rumus.coloumAndGain[i].Gain.ToString(), 18); } //double test = Rumus.Entropy(3,0,3); //jenis beasiswa; temp = DatabaseScript.SearchDataEntropy("Jenis_beasiswa", "BBM"); tree.Nodes[1].Nodes[0].Nodes[0].Text = SetText("BBM", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 5); temp = DatabaseScript.SearchDataEntropy("Jenis_beasiswa", "PPA"); tree.Nodes[1].Nodes[0].Nodes[1].Text = SetText("PPA", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 5); //prestasi temp = DatabaseScript.SearchDataEntropy("Prestasi", "Internasional"); tree.Nodes[1].Nodes[4].Nodes[0].Text = SetText("Internasional", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 14); temp = DatabaseScript.SearchDataEntropy("Prestasi", "Nasional"); tree.Nodes[1].Nodes[4].Nodes[1].Text = SetText("Nasional", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 14); temp = DatabaseScript.SearchDataEntropy("Prestasi", "Regional"); tree.Nodes[1].Nodes[4].Nodes[2].Text = SetText("Regional", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 14); temp = DatabaseScript.SearchDataEntropy("Prestasi", "Lokal"); tree.Nodes[1].Nodes[4].Nodes[3].Text = SetText("Lokal", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 14); //aktif anggota temp = DatabaseScript.SearchDataEntropy("Aktif_Organisasi", "Ketua"); tree.Nodes[1].Nodes[2].Nodes[0].Text = SetText("Ketua", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 10); temp = DatabaseScript.SearchDataEntropy("Aktif_Organisasi", "Pengurus"); tree.Nodes[1].Nodes[2].Nodes[1].Text = SetText("Pengurus", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 10); temp = DatabaseScript.SearchDataEntropy("Aktif_Organisasi", "Anggota"); tree.Nodes[1].Nodes[2].Nodes[2].Text = SetText("Anggota", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 10); //Semesta temp = DatabaseScript.SearchDataEntropy("Select count(IF(Diterima ='ya',1,Null)) as ya,count(IF(Diterima ='tidak',1,Null)) as tidak,count(IF(Diterima,1,Null)) as total from beasiswa;"); tree.Nodes[1].Nodes[5].Text = SetText("Semesta", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 10); //Financial temp = DatabaseScript.SearchDataEntropy("select count(if(Financial <= 1000000,1,Null) AND if(Diterima='Ya',1,Null))as Ya,count(if(Financial <= 1000000,1,Null) AND if(Diterima='Tidak',1,Null))as Tidak,count(if(Financial <= 1000000,1,Null)) Total from beasiswa;"); tree.Nodes[1].Nodes[3].Nodes[0].Text = SetText(" <=1jt", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(Financial <= 5000000,1,Null) AND if(Financial > 1000000,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(Financial <= 5000000,1,Null) AND if(Financial > 1000000,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(Financial <= 5000000,1,Null) AND if(Financial > 1000000,1,Null)) as Total from beasiswa;"); tree.Nodes[1].Nodes[3].Nodes[1].Text = SetText(" 1jt - 5jt", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(Financial <= 7500000,1,Null) AND if(Financial > 5000000,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(Financial <= 7500000,1,Null) AND if(Financial > 5000000,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(Financial <= 7500000,1,Null) AND if(Financial > 5000000,1,Null)) as Total from beasiswa;"); tree.Nodes[1].Nodes[3].Nodes[2].Text = SetText(" 5jt - 7.5jt", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(Financial <= 10000000,1,Null) AND if(Financial > 7500000,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(Financial <= 10000000,1,Null) AND if(Financial > 7500000,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(Financial <= 10000000,1,Null) AND if(Financial > 7500000,1,Null)) as Total from beasiswa;"); tree.Nodes[1].Nodes[3].Nodes[3].Text = SetText("7.5jt - 10jt", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(Financial > 10000000,1,Null) AND if(Diterima='Ya',1,Null))as Ya,count(if(Financial > 10000000,1,Null) AND if(Diterima='Tidak',1,Null))as Tidak,count(if(Financial > 10000000,1,Null)) Total from beasiswa;"); tree.Nodes[1].Nodes[3].Nodes[4].Text = SetText(" > 10jt", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); //IPK temp = DatabaseScript.SearchDataEntropy("select count(if(ipk = '4',1,Null) AND if(Diterima='Ya',1,Null))as Ya,count(if(ipk = '4',1,Null) AND if(Diterima='Tidak',1,Null))as Tidak,count(if(ipk = '4',1,Null)) Total from beasiswa;"); tree.Nodes[1].Nodes[1].Nodes[0].Text = SetText(" 4 ", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(ipk < 4,1,Null) AND if(ipk >= 3.5,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(ipk < 4,1,Null) AND if(ipk >= 3.5,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(ipk < 4,1,Null) AND if(ipk >= 3.5,1,Null)) as Total from beasiswa;"); tree.Nodes[1].Nodes[1].Nodes[1].Text = SetText(" 4 - 3.5 ", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(ipk < 3.5,1,Null) AND if(ipk >= 3.25,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(ipk < 3.5,1,Null) AND if(ipk >= 3.25,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(ipk < 3.5,1,Null) AND if(ipk >= 3.25,1,Null)) as Total from beasiswa;"); tree.Nodes[1].Nodes[1].Nodes[2].Text = SetText("3.5 - 3.25", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(ipk < 3.25,1,Null) AND if(ipk >= 3,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(ipk < 3.25,1,Null) AND if(ipk >= 3,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(ipk < 3.25,1,Null) AND if(ipk >= 3,1,Null)) as Total from beasiswa;"); tree.Nodes[1].Nodes[1].Nodes[3].Text = SetText("3.25- 3 ", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); temp = DatabaseScript.SearchDataEntropy("select count(if(ipk < 3,1,Null) AND if(Diterima='Ya',1,Null)) as Ya,count(if(ipk < 3,1,Null) AND if(Diterima='Tidak',1,Null)) as Tidak,count(if(ipk < 3,1,Null))as Total from beasiswa;"); tree.Nodes[1].Nodes[1].Nodes[4].Text = SetText(" < 3 ", Rumus.Entropy(temp[0], temp[1], temp[2]).ToString(), 15); }