Professional Documents
Culture Documents
Yield _Predictor.java
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import weka.classifiers.Evaluation;
import weka.classifiers.trees.J48;
import weka.core.Instances;
import javax.swing.JTextField;
import java.awt.Font;
import javax.swing.JButton;
import javax.swing.SwingConstants;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.awt.event.ActionEvent;
import weka.classifiers.Evaluation;
import weka.classifiers.bayes.NaiveBayes;
import weka.classifiers.trees.J48;
import weka.core.Attribute;
import weka.core.DenseInstance;
import weka.core.FastVector;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.converters.ArffLoader.ArffReader;
import javax.swing.JTextArea;
import javax.swing.JTabbedPane;
import javax.swing.event.ChangeListener;
import javax.swing.event.ChangeEvent;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Yeild_Predictor extends JFrame
/**
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
try {
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
});
/**
*/
public Yeild_Predictor() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setContentPane(contentPane);
tabbedPane.addChangeListener(new ChangeListener() {
if(tabbedPane.getSelectedIndex()==1)
String crop_name=lblNewLabel_22.getText();
if(!crop_name.isEmpty())
int count=0;
try{
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Creating statement...");
stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while(rs.next())
textField_19.setText(rs.getString(3));
textField_21.setText(rs.getString(4));
textField_23.setText(rs.getString(5));
textField_25.setText(rs.getString(6));
textField_27.setText(rs.getString(7));
textField_35.setText(rs.getString(8));
textField_37.setText(rs.getString(9));
textField_39.setText(rs.getString(10));
textField_41.setText(rs.getString(11));
textField_29.setText(rs.getString(12));
textField_31.setText(rs.getString(13));
textField_33.setText(rs.getString(14));
textField_43.setText(rs.getString(15));
textField_45.setText(rs.getString(16));
textField_47.setText(rs.getString(17));
textField_49.setText(rs.getString(18));
textField_51.setText(rs.getString(19));
textField_53.setText(rs.getString(20));
int value=Integer.parseInt(textField_26.getText())-
Integer.parseInt(rs.getString(7));
lblNewLabel_23.setText(str);
else
int
value=Integer.parseInt(rs.getString(7))-Integer.parseInt(textField_26.getText());
lblNewLabel_23.setText(str);
{
int
value=Integer.parseInt(textField_18.getText())-Integer.parseInt(rs.getString(3));
lblNewLabel_25.setText(str);
else
int
value=Integer.parseInt(rs.getString(3))-Integer.parseInt(textField_18.getText());
lblNewLabel_25.setText(str);
int
value=Integer.parseInt(textField_34.getText())-Integer.parseInt(rs.getString(8));
lblNewLabel_27.setText(str);
else
{
int
value=Integer.parseInt(rs.getString(8))-Integer.parseInt(textField_34.getText());
lblNewLabel_27.setText(str);
int
total_y=(Integer.parseInt(textField_26.getText())*Integer.parseInt(rs.getString(
20)))/Integer.parseInt(textField_27.getText());
lblNewLabel_29.setText(String.valueOf(total_y)+" kg/Acre");
int total=
Integer.parseInt(textField_52.getText())-total_y;
lblNewLabel_30.setText("Which
is "+String.valueOf(total)+" kg/Acre will decrease What you expect");
else
lblNewLabel_30.setText("Which
is "+String.valueOf(total)+" kg/Acre will increase What you expect");
}
}
rs.close();
}catch(SQLException se){
se.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}finally{
try{
if(stmt!=null)
conn.close();
}catch(SQLException se){
}// do nothing
try{
if(conn!=null)
conn.close();
}catch(SQLException se){
se.printStackTrace();
}//end try
System.out.println("Goodbye!");
});
contentPane.add(tabbedPane, BorderLayout.CENTER);
//tabbedPane.setEnabledAt(0,false);
panel.setBackground(Color.LIGHT_GRAY);
panel.setLayout(null);
lblCropsEnvironmentalParameters.setForeground(Color.MAGENTA);
panel.add(lblCropsEnvironmentalParameters);
JLabel lblNewLabel = new JLabel("PH Value");
lblNewLabel.setForeground(Color.BLUE);
panel.add(lblNewLabel);
panel.add(textField);
textField.setColumns(10);
lblNewLabel_1.setForeground(Color.BLUE);
panel.add(lblNewLabel_1);
lblNewLabel_2.setForeground(Color.BLUE);
lblWaterLevel.setForeground(Color.BLUE);
panel.add(lblWaterLevel);
lblNewLabel_3.setForeground(Color.BLUE);
panel.add(lblNewLabel_3);
lblPhospateValue.setForeground(Color.BLUE);
panel.add(lblPhospateValue);
lblPotassiumValue.setForeground(Color.BLUE);
panel.add(lblPotassiumValue);
lblDepthOfLand.setForeground(Color.BLUE);
panel.add(lblDepthOfLand);
lblTemperature.setForeground(Color.BLUE);
panel.add(lblTemperature);
lblHumidity.setForeground(Color.BLUE);
lblHumidity.setBounds(10, 86, 169, 14);
panel.add(lblHumidity);
lblOxygen.setForeground(Color.BLUE);
panel.add(lblOxygen);
lblSunlight.setForeground(Color.BLUE);
panel.add(lblSunlight);
lblIron.setForeground(Color.BLUE);
panel.add(lblIron);
JLabel lblZinc = new JLabel("Zinc (mg)");
lblZinc.setForeground(Color.BLUE);
panel.add(lblZinc);
lblManganse.setForeground(Color.BLUE);
panel.add(lblManganse);
lblRainfall.setForeground(Color.BLUE);
panel.add(lblRainfall);
lblSoilType.setForeground(Color.BLUE);
lblSoilType.setFont(new Font("Times New Roman", Font.ITALIC,
12));
panel.add(lblSoilType);
lblYeild.setForeground(Color.BLUE);
panel.add(lblYeild);
lblCropsWaterParameters.setForeground(Color.MAGENTA);
panel.add(lblCropsWaterParameters);
lblCropsMineralsParameters.setForeground(Color.MAGENTA);
panel.add(lblCropsMineralsParameters);
lblCropsSoilParameters.setForeground(Color.MAGENTA);
panel.add(lblCropsSoilParameters);
panel.add(textField_1);
textField_1.setColumns(10);
panel.add(textField_2);
textField_2.setColumns(10);
panel.add(textField_3);
textField_3.setColumns(10);
panel.add(textField_4);
textField_4.setColumns(10);
panel.add(textField_5);
textField_5.setColumns(10);
panel.add(textField_6);
textField_6.setColumns(10);
panel.add(textField_7);
textField_7.setColumns(10);
panel.add(textField_8);
textField_8.setColumns(10);
panel.add(textField_9);
textField_9.setColumns(10);
panel.add(textField_10);
textField_10.setColumns(10);
panel.add(textField_11);
textField_11.setColumns(10);
panel.add(textField_12);
textField_12.setColumns(10);
textField_13 = new JTextField();
panel.add(textField_13);
textField_13.setColumns(10);
panel.add(textField_14);
textField_14.setColumns(10);
panel.add(textField_15);
textField_15.setColumns(10);
panel.add(textField_16);
textField_16.setColumns(10);
textField_17.setColumns(10);
panel.add(lblNewLabel_4);
panel.add(lblNewLabel_5);
panel.add(lblNewLabel_6);
panel.add(lblNewLabel_7);
panel.add(lblNewLabel_8);
JLabel lblNewLabel_9 = new JLabel("Range : 10 - 100");
panel.add(lblNewLabel_9);
panel.add(lblNewLabel_10);
panel.add(lblNewLabel_11);
panel.add(lblNewLabel_12);
panel.add(lblNewLabel_13);
panel.add(lblNewLabel_14);
JLabel lblNewLabel_15 = new JLabel("Range : 0 - 4");
panel.add(lblNewLabel_15);
panel.add(lblNewLabel_16);
panel.add(lblNewLabel_17);
panel.add(lblNewLabel_18);
panel.add(lblNewLabel_19);
panel.add(lblNewLabel_21);
panel.add(panel_1);
panel_1.setLayout(null);
panel_1.add(lblConfusionMatrix);
panel_1.add(textArea);
JPanel panel_2 = new JPanel();
panel_2.setBackground(Color.WHITE);
panel.add(panel_2);
panel_2.setLayout(null);
panel_2.add(lblPredictedCrop);
lblNewLabel_22.setForeground(Color.CYAN);
lblNewLabel_22.setHorizontalAlignment(SwingConstants.CENTER);
panel_2.add(lblNewLabel_22);
panel_3.setLayout(null);
panel_3.add(btnNewButton);
panel_3.add(lblPredictResult);
panel_4.setLayout(null);
lblCropsEnvironmentalParameters_1.setForeground(Color.MAGENTA);
lblCropsEnvironmentalParameters_1.setFont(new Font("Times
New Roman", Font.BOLD | Font.ITALIC, 14));
lblCropsEnvironmentalParameters_1.setBounds(10, 11, 217, 14);
panel_4.add(lblCropsEnvironmentalParameters_1);
label_3.setForeground(Color.BLUE);
panel_4.add(label_3);
label_4.setForeground(Color.BLUE);
panel_4.add(label_4);
label_5.setForeground(Color.BLUE);
panel_4.add(label_5);
JLabel label_6 = new JLabel("Oxygen (%)");
label_6.setForeground(Color.BLUE);
panel_4.add(label_6);
label_7.setForeground(Color.BLUE);
panel_4.add(label_7);
label_8.setForeground(Color.BLUE);
panel_4.add(label_8);
label_9.setForeground(Color.BLUE);
label_9.setFont(new Font("Times New Roman", Font.ITALIC,
13));
panel_4.add(label_9);
label_10.setForeground(Color.BLUE);
panel_4.add(label_10);
label_11.setForeground(Color.BLUE);
panel_4.add(label_11);
label_15.setForeground(Color.BLUE);
label_16.setForeground(Color.BLUE);
panel_4.add(label_16);
label_17.setForeground(Color.BLUE);
panel_4.add(label_17);
label_18.setForeground(Color.BLUE);
panel_4.add(label_18);
panel_4.add(label_19);
label_20.setForeground(Color.BLUE);
panel_4.add(label_20);
panel_4.add(panel_5);
panel_5.setLayout(null);
panel_5.add(lblActual);
textField_18.setHorizontalAlignment(SwingConstants.CENTER);
panel_5.add(textField_18);
textField_18.setColumns(10);
textField_19.setHorizontalAlignment(SwingConstants.CENTER);
panel_5.add(textField_19);
textField_19.setColumns(10);
panel_6.setLayout(null);
panel_4.add(panel_6);
panel_6.add(label_23);
JLabel label_24 = new JLabel("Predicted :");
panel_6.add(label_24);
textField_20.setHorizontalAlignment(SwingConstants.CENTER);
textField_20.setColumns(10);
panel_6.add(textField_20);
textField_21.setHorizontalAlignment(SwingConstants.CENTER);
textField_21.setColumns(10);
panel_6.add(textField_21);
panel_7.setLayout(null);
panel_4.add(panel_7);
panel_7.add(label_26);
textField_22.setHorizontalAlignment(SwingConstants.CENTER);
textField_22.setColumns(10);
panel_7.add(textField_22);
textField_23.setHorizontalAlignment(SwingConstants.CENTER);
textField_23.setColumns(10);
panel_7.add(textField_23);
panel_8.setLayout(null);
panel_4.add(panel_8);
JLabel label_27 = new JLabel("Actual :");
panel_8.add(label_27);
panel_8.add(label_28);
textField_24.setHorizontalAlignment(SwingConstants.CENTER);
textField_24.setColumns(10);
panel_8.add(textField_24);
textField_25.setHorizontalAlignment(SwingConstants.CENTER);
textField_25.setColumns(10);
panel_8.add(textField_25);
panel_9.setLayout(null);
panel_9.add(label_29);
panel_9.add(label_30);
textField_26.setHorizontalAlignment(SwingConstants.CENTER);
textField_26.setColumns(10);
panel_9.add(textField_26);
textField_27.setHorizontalAlignment(SwingConstants.CENTER);
textField_27.setColumns(10);
panel_9.add(textField_27);
panel_4.add(panel_10);
panel_10.add(label_31);
panel_10.add(label_32);
textField_28.setHorizontalAlignment(SwingConstants.CENTER);
textField_28.setColumns(10);
panel_10.add(textField_28);
textField_29.setHorizontalAlignment(SwingConstants.CENTER);
textField_29.setColumns(10);
panel_10.add(textField_29);
JPanel panel_11 = new JPanel();
panel_11.setLayout(null);
panel_4.add(panel_11);
panel_11.add(label_33);
panel_11.add(label_34);
textField_30.setHorizontalAlignment(SwingConstants.CENTER);
textField_30.setColumns(10);
panel_11.add(textField_30);
textField_31.setHorizontalAlignment(SwingConstants.CENTER);
textField_31.setColumns(10);
textField_31.setBounds(78, 36, 86, 20);
panel_11.add(textField_31);
panel_12.setLayout(null);
panel_4.add(panel_12);
panel_12.add(label_35);
panel_12.add(label_36);
textField_32.setHorizontalAlignment(SwingConstants.CENTER);
textField_32.setColumns(10);
panel_12.add(textField_32);
textField_33.setColumns(10);
panel_12.add(textField_33);
panel_13.setLayout(null);
panel_4.add(panel_13);
panel_13.add(label_1);
panel_13.add(label_37);
textField_34.setHorizontalAlignment(SwingConstants.CENTER);
textField_34.setColumns(10);
panel_13.add(textField_34);
textField_35 = new JTextField();
textField_35.setHorizontalAlignment(SwingConstants.CENTER);
textField_35.setColumns(10);
panel_13.add(textField_35);
panel_14.setLayout(null);
panel_4.add(panel_14);
panel_14.add(label_38);
panel_14.add(label_39);
textField_36.setHorizontalAlignment(SwingConstants.CENTER);
textField_36.setColumns(10);
textField_36.setBounds(78, 8, 86, 20);
panel_14.add(textField_36);
textField_37.setHorizontalAlignment(SwingConstants.CENTER);
textField_37.setColumns(10);
panel_14.add(textField_37);
panel_15.setLayout(null);
panel_4.add(panel_15);
panel_15.add(label_40);
panel_15.add(label_41);
textField_38.setColumns(10);
panel_15.add(textField_38);
textField_39.setHorizontalAlignment(SwingConstants.CENTER);
textField_39.setColumns(10);
panel_15.add(textField_39);
panel_16.setLayout(null);
panel_4.add(panel_16);
panel_16.add(label_21);
panel_16.add(label_42);
textField_40 = new JTextField();
textField_40.setHorizontalAlignment(SwingConstants.CENTER);
textField_40.setColumns(10);
panel_16.add(textField_40);
textField_41.setHorizontalAlignment(SwingConstants.CENTER);
textField_41.setColumns(10);
panel_16.add(textField_41);
panel_18.setLayout(null);
panel_4.add(panel_18);
panel_18.add(label_14);
panel_18.add(label_22);
textField_42.setHorizontalAlignment(SwingConstants.CENTER);
textField_42.setColumns(10);
panel_18.add(textField_42);
textField_43.setHorizontalAlignment(SwingConstants.CENTER);
textField_43.setColumns(10);
panel_18.add(textField_43);
panel_19.setLayout(null);
panel_4.add(panel_19);
panel_19.add(label_43);
JLabel label_44 = new JLabel("Predicted :");
panel_19.add(label_44);
textField_44.setHorizontalAlignment(SwingConstants.CENTER);
textField_44.setColumns(10);
panel_19.add(textField_44);
textField_45.setHorizontalAlignment(SwingConstants.CENTER);
textField_45.setColumns(10);
panel_19.add(textField_45);
panel_20.setLayout(null);
panel_4.add(panel_20);
panel_20.add(label_45);
panel_20.add(label_46);
textField_46.setHorizontalAlignment(SwingConstants.CENTER);
textField_46.setColumns(10);
panel_20.add(textField_46);
textField_47.setHorizontalAlignment(SwingConstants.CENTER);
textField_47.setColumns(10);
panel_20.add(textField_47);
panel_17.setLayout(null);
JLabel label_2 = new JLabel("Potassium (mg)");
label_2.setForeground(Color.BLUE);
panel_17.add(label_2);
label_12.setForeground(Color.BLUE);
panel_17.add(label_12);
label_13.setForeground(Color.BLUE);
panel_17.add(label_13);
panel_21.setLayout(null);
panel_21.add(label_47);
panel_21.add(label_48);
textField_48.setHorizontalAlignment(SwingConstants.CENTER);
textField_48.setColumns(10);
panel_21.add(textField_48);
textField_49.setHorizontalAlignment(SwingConstants.CENTER);
textField_49.setColumns(10);
panel_21.add(textField_49);
panel_17.add(panel_22);
panel_22.add(label_49);
panel_22.add(label_50);
textField_50.setHorizontalAlignment(SwingConstants.CENTER);
textField_50.setColumns(10);
panel_22.add(textField_50);
textField_51.setHorizontalAlignment(SwingConstants.CENTER);
textField_51.setColumns(10);
panel_22.add(textField_51);
JPanel panel_23 = new JPanel();
panel_23.setLayout(null);
panel_17.add(panel_23);
panel_23.add(label_51);
panel_23.add(label_52);
textField_52.setHorizontalAlignment(SwingConstants.CENTER);
textField_52.setColumns(10);
panel_23.add(textField_52);
textField_53.setHorizontalAlignment(SwingConstants.CENTER);
textField_53.setColumns(10);
textField_53.setBounds(78, 36, 86, 20);
panel_23.add(textField_53);
lblReport.setForeground(Color.BLUE);
panel_17.add(lblReport);
panel_17.add(label_53);
panel_17.add(lblNewLabel_23);
panel_17.add(label_54);
lblNewLabel_25 = new JLabel("New label");
panel_17.add(lblNewLabel_25);
panel_17.add(label_55);
panel_17.add(lblNewLabel_27);
lblResult.setForeground(Color.MAGENTA);
panel_17.add(lblResult);
panel_17.add(lblNewLabel_29);
lblNewLabel_30.setForeground(Color.BLUE);
panel_17.add(lblNewLabel_30);
btnNewButton.addActionListener(new ActionListener() {
try {
store();
e1.printStackTrace();
}
//////////////////////////////////Prediction Result from files/////////////////////
try {
} catch (IOException e) {
e.printStackTrace();
train.setClassIndex(train.numAttributes() - 1);
try {
} catch (IOException e) {
e.printStackTrace();
test.setClassIndex(test.numAttributes() - 1);
J48 descision=new J48();
try {
descision.buildClassifier(train);
} catch (Exception e) {
e.printStackTrace();
try {
} catch (Exception e) {
e.printStackTrace();
try {
evaluation.evaluateModel(descision, test);
} catch (Exception e) {
e.printStackTrace();
}
//lblNewLabel_2.setText(evaluation.toSummaryString());
// textArea.setText(evaluation.toSummaryString());
//System.out.println(evaluation.toSummaryString());
try {
//textArea_1.setText(evaluation.toClassDetailsString());
System.out.println(evaluation.toClassDetailsString());
} catch (Exception e) {
e.printStackTrace();
try {
textArea.setText(evaluation.toMatrixString());
System.out.println(evaluation.toMatrixString());
} catch (Exception e) {
e.printStackTrace();
double label = 0;
try {
label = descision.classifyInstance(test.instance(0));
} catch (Exception e) {
e.printStackTrace();
test.instance(0).setClassValue(label);
//System.out.println(test.instance(0).value(18));
switch(predict)
case 0:
lblNewLabel_22.setText("Wheat");
break;
case 1:
lblNewLabel_22.setText("Mung");
break;
case 2:
lblNewLabel_22.setText("Harbara");
break;
case 3:
lblNewLabel_22.setText("Cotton");
break;
case 4:
lblNewLabel_22.setText("Sugarcane");
break;
case 5:
lblNewLabel_22.setText("Tomato");
break;
case 6:
lblNewLabel_22.setText("Potato");
break;
case 7:
lblNewLabel_22.setText("Chilly");
break;
case 8:
lblNewLabel_22.setText("Onion");
break;
case 9:
lblNewLabel_22.setText("Mango");
break;
case 10:
lblNewLabel_22.setText("Orange");
break;
case 11:
lblNewLabel_22.setText("Coconut");
break;
case 12:
lblNewLabel_22.setText("Fanas");
break;
case 13:
lblNewLabel_22.setText("Groundnut");
break;
case 14:
lblNewLabel_22.setText("Soyabean");
break;
case 15:
lblNewLabel_22.setText("Sunflower");
break;
case 16:
lblNewLabel_22.setText("Tur");
break;
case 17:
lblNewLabel_22.setText("Banana");
break;
case 18:
lblNewLabel_22.setText("Jowar");
break;
case 19:
lblNewLabel_22.setText("Rice");
break;
case 20:
lblNewLabel_22.setText("Bajara");
break;
case 21:
lblNewLabel_22.setText("Corn");
break;
default:
break;
/*if(test.instance(0).value(13)==0)
lblNewLabel_15.setText("Normal");
lblNewLabel_15.setForeground(customColor);
}*/
}
});
try {
return inputReader;
}
public void store() throws IOException
FastVector atts;
FastVector attsRel;
FastVector attVals;
FastVector attValsRel;
Instances data;
Instances dataRel;
double[] vals;
double[] valsRel;
int i;
// 1. set up attributes
// - numeric
atts.addElement(new Attribute("Temperature"));
// - nominal
attVals.addElement("1");
attVals.addElement("2");
attVals.addElement("3");
attVals.addElement("4");
attVals.addElement("5");
attVals.addElement("6");
attVals.addElement("7");
attVals.addElement("8");
attVals.addElement("9");
attVals.addElement("10");
attVals.addElement("11");
attVals.addElement("12");
attVals.addElement("13");
attVals.addElement("14");
attVals.addElement("15");
attVals.addElement("16");
attVals.addElement("17");
attVals.addElement("18");
attVals.addElement("19");
attVals.addElement("20");
attVals.addElement("21");
attVals.addElement("22");
atts.addElement(new Attribute("Humidity"));
// - string
atts.addElement(new Attribute("Sunlight"));
// - date
atts.addElement(new Attribute("Oxygen"));
// - relational
// -- numeric
atts.addElement(new Attribute("Rainfall"));
// -- nominal
atts.addElement(new Attribute("Water_Level"));
atts.addElement(new Attribute("Salinity"));
atts.addElement(new Attribute("Acidity"));
atts.addElement(new Attribute("Ph"));
atts.addElement(new Attribute("Iron"));
atts.addElement(new Attribute("Zinc"));
atts.addElement(new Attribute("Manganse"));
atts.addElement(new Attribute("Soil"));
atts.addElement(new Attribute("Depth"));
atts.addElement(new Attribute("Nitrogen"));
atts.addElement(new Attribute("Potassium"));
atts.addElement(new Attribute("Phospate"));
atts.addElement(new Attribute("Yeild"));
atts.addElement(new Attribute("result",attVals));
// 2. create Instances object
vals[0]=Double.parseDouble(textField.getText());
textField_18.setText(textField.getText());
vals[1]=Double.parseDouble(textField_1.getText());
textField_20.setText(textField_1.getText());
vals[2]=Double.parseDouble(textField_2.getText());
textField_22.setText(textField_2.getText());
vals[3]=Double.parseDouble(textField_3.getText());
textField_24.setText(textField_3.getText());
vals[4]=Double.parseDouble(textField_4.getText());
textField_26.setText(textField_4.getText());
vals[5]=Double.parseDouble(textField_5.getText());
textField_34.setText(textField_5.getText());
vals[6]=Double.parseDouble(textField_6.getText());
textField_36.setText(textField_6.getText());
vals[7]=Double.parseDouble(textField_7.getText());
textField_38.setText(textField_7.getText());
vals[8]=Double.parseDouble(textField_8.getText());
textField_40.setText(textField_8.getText());
vals[9]=Double.parseDouble(textField_9.getText());
textField_28.setText(textField_9.getText());
vals[10]=Double.parseDouble(textField_10.getText());
textField_30.setText(textField_10.getText());
vals[11]=Double.parseDouble(textField_11.getText());
textField_32.setText(textField_11.getText());
vals[12]=Double.parseDouble(textField_12.getText());
textField_42.setText(textField_12.getText());
vals[13]=Double.parseDouble(textField_13.getText());
textField_44.setText(textField_13.getText());
vals[14]=Double.parseDouble(textField_14.getText());
textField_46.setText(textField_14.getText());
vals[15]=Double.parseDouble(textField_15.getText());
textField_48.setText(textField_15.getText());
vals[16]=Double.parseDouble(textField_16.getText());
textField_50.setText(textField_16.getText());
vals[17]=Double.parseDouble(textField_17.getText());
textField_52.setText(textField_17.getText());
// vals[13]=Double.parseDouble(den);
// add
// 4. output data
// System.out.println(data);
writer.write(data.toString());
writer.flush();
writer.close();
Crop_data . sql
USE `crop_data`;
--
-- ------------------------------------------------------
/*!40101 SET
@OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET
@OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS
*/;
/*!40101 SET
@OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION
*/;
/*!40014 SET
@OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS,
FOREIGN_KEY_CHECKS=0 */;
--
--
--
--
UNLOCK TABLES;
/*!40014 SET
FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET
CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET
CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET
COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Crop_data_routines.sql
USE `crop_data`;
--
-- ------------------------------------------------------
/*!40101 SET
@OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET
@OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS
*/;
/*!40101 SET
@OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION
*/;
/*!40101 SET NAMES utf8 */;
/*!40014 SET
@OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS,
FOREIGN_KEY_CHECKS=0 */;
--
--
--
--
/*!40014 SET
FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET
CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET
COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
crop_training.arff
@relation Crop_Training
@attribute Ph numeric
@data
38,32,250,34,1000,95,1.45,4.8,8.5,3.68,1.8,2,3,25,50, 20,56,55,1
42,328,320,28,900,105,1.45,2.8,6.5,5.68,2.8,1,4,18,45,18,48,45,1
30,30,100, 30,250,35,1.2,3,8,5,2,2.4,1,10,60,70,15,46,2
40,30,300,10,350,60, 0.495,1.5,5,6,3,1,1,20,10,58,25,65,3
30,25,250,20,480,50, 0.195,3.5,6,2,1,3,2,35,25,88,35,54,3
34,26,220,40,1200,80,0.7,1.8,6.6,4.7,0.8,3.5,3,50,40, 20,36,36,5
30,36,100, 35,1300,95,0.75,1.5,6.9,4.5,0.6,2.8,3,35,55,25,28,48,5
32,48,150,20,950,60, 0.5,1.8,6.2,5.5,0.8,1.6,3,10,20,32,60,55,6
26,42,180,32,850,83, 0.4,2.5,6.0,4.7,0.9,2.0,3,15,35,32,130,58,7
36,40,160,36,950,80, 0.5,2.2,6.5,4.8,0.7,2.6,3,25,25,30,150,50,7
28,53,200, 20,1200,55,0.4,2.5,6.4,4.6,0.2,0.5,2,20,23,25,75,45,14
30,55,180,30,1500,45,0.8,2.8,6.0,4.0,0.6,0.8,2,30,20,30,70,50,14
32,50,220, 25,1350,50,0.6,2.6,6.8,4.2,0.4,0.6,2,25,26,35,65,55,14
Test.arff
@relation Crop_Test
@attribute Ph numeric
@data
26,21,101,11,101,11,0.3,2,7,4.5,1,1,2,11,21,1,21,1,1