Vous êtes sur la page 1sur 10

Eliminated Data: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.

Linq; using System.Text; using System.Windows.Forms; using System.IO; using System.Data.SqlClient; using System.Windows.Documents; using System.Windows.Controls; using ADOX; namespace gfoidl.SammonProjection.Demo { public partial class Eleminateddata : Form { public Eleminateddata() { InitializeComponent(); } private void Eleminateddata_Load(object sender, EventArgs e) { DataTable dt1 = GetDataTable("E:\\MiningProjection\\gfoidl.SammonProjection.Demo\\bin\\iris_data4.csv"); dataGridView4.DataSource = dt1.DefaultView;

DataTable dt2 = GetDataTable("E:\\MiningProjection\\gfoidl.SammonProjection.Demo\\bin\\iris_data5.csv"); dataGridView5.DataSource = dt2.DefaultView; DataTable dt3 = GetDataTable("E:\\MiningProjection\\gfoidl.SammonProjection.Demo\\bin\\iris_data6.csv"); dataGridView6.DataSource = dt3.DefaultView;

private void btncluster_Click(object sender, EventArgs e) { Form1 obj = new Form1(); obj.Show(); } this.Hide();

public static DataTable GetDataTable(string strFileName) { ADODB.Connection oConn = new ADODB.Connection(); oConn.Open("Provider=Microsoft.Jet.OleDb.4.0; Data Source = " + System.IO.Path.GetDirectoryName(strFileName) + "; Extended Properties = \"Text;HDR=YES;FMT=Delimited\";", "", "", 0); string strQuery = "SELECT * FROM [" + System.IO.Path.GetFileName(strFileName) + "]"; ADODB.Recordset rs = new ADODB.Recordset(); System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter(); DataTable dt = new DataTable(); rs.Open(strQuery, "Provider=Microsoft.Jet.OleDb.4.0; Data Source = " + System.IO.Path.GetDirectoryName(strFileName) + "; Extended Properties = \"Text;HDR=YES;FMT=Delimited\";", ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly, 1); adapter.Fill(dt, rs); rs.Close(); oConn.Close(); return dt; } }

using System; using System.Collections.Generic; using System.Drawing; using System.Globalization; using System.IO; using System.Windows.Forms; using ZedGraph; namespace gfoidl.SammonProjection.Demo { public partial class Form1 : Form { private const int INPUT_DIMENSION = 4; private const string FILE = "iris_dataeliminatedset.csv"; private double[][] _inputData; //--------------------------------------------------------------------public Form1() { InitializeComponent(); } //--------------------------------------------------------------------private void button1_Click(object sender, EventArgs e) { }

private void ReadData() {

List<double[]> inputs = new List<double[]>(); using (StreamReader sr = File.OpenText(FILE)) { // Kopfzeile berlesen: sr.ReadLine(); while (!sr.EndOfStream) { string line = sr.ReadLine(); string[] cols = line.Split(';');

double[INPUT_DIMENSION]; 1], NumberFormatInfo.InvariantInfo); } } }

double[] input = new for (int i = 0; i < INPUT_DIMENSION; i++) input[i] = double.Parse(cols[i + inputs.Add(input);

_inputData = inputs.ToArray();

private Bitmap CreateProjection() {

SammonsProjection projection = new SammonsProjection( _inputData, 2, 1000); projection.CreateMapping(); // Create colors and labels - here a lazy version is shown, it should // be read from the data set in real applications ;) Color[] color = new Color[150]; string[] labels = new string[150]; for (int i = 0; i < 50; i++) { color[i] = Color.Red; labels[i] = "set"; } for (int i = 50; i < 100; i++) { color[i] = Color.Green; labels[i] = "vers"; } for (int i = 100; i < 150; i++) { color[i] = Color.Blue; labels[i] = "virg"; } SammonsProjectionPostProcess processing = new SammonsProjectionPostProcess( projection); processing.PointSize = 4; processing.FontSize = 8; return processing.CreateImage(300, 300, labels, color);

private void pictureBox1_Click(object sender, EventArgs e) { } private void Form1_Load(object sender, EventArgs e) { ReadData(); Bitmap bmp = CreateProjection(); pictureBox1.Image = bmp; } private void btnshow_Click(object sender, EventArgs e) { Graph obj = new Graph(); obj.Show();

}
} }

this.Hide();

Vous aimerez peut-être aussi