I have to divide dataset into training dataset(80%) and test dataset (20%) using random sampling.I have to implement it in c#.If anyone knows,please help me.....
sherinpoulose
0
Light Poster
Recommended Answers
Jump to PostOk, because Im so good and willing to help yet, I did the code for you:
Random r = new Random(); private void Method() { DataTable table1 = new DataTable("table1"); DataTable table2 = new DataTable("table2"); //I will use only one column, but the same is if you …
Jump to PostChange line 18 (
int myRandom = r.Next(table1.Rows.Count);
to the number of rows you need in one table and you should end up with one take with one percentage, the other with the rest. For example, you'd change the line toint myRandom = (int)(table1.Rows.Count * .80); // Multiply by …
Jump to PostOne thing to mention: the code I pasted above is written by heart - so there can be some errors, but I hope there are not :)!
Jump to PostMy post was not pointless as the post was originally in Computer Science forum and does not carry any scientific interest. I think you should know by now the rules of Daniweb as you have quite a few posts under your belt. You might anyway read my post in my …
Jump to PostYOu know what... I was only trying to help him, because I knew he would have come back and asking me for more info, how this, how that, and so on...
Thats why I decided to give him a code, to see exactly what he needs.But ok, from …
All 29 Replies
TrustyTony
888
pyMod
Team Colleague
Featured Poster
Mitja Bonca
557
Nearly a Posting Maven
sherinpoulose
0
Light Poster
Mitja Bonca
557
Nearly a Posting Maven
Momerath
1,327
Nearly a Senior Poster
Featured Poster
sherinpoulose
0
Light Poster
Mitja Bonca
557
Nearly a Posting Maven
sherinpoulose
0
Light Poster
Mitja Bonca
557
Nearly a Posting Maven
sherinpoulose
0
Light Poster
Momerath
1,327
Nearly a Senior Poster
Featured Poster
sherinpoulose
0
Light Poster
Mitja Bonca
557
Nearly a Posting Maven
sherinpoulose
0
Light Poster
Mitja Bonca
557
Nearly a Posting Maven
Mitja Bonca
557
Nearly a Posting Maven
sherinpoulose
0
Light Poster
sherinpoulose
0
Light Poster
Mitja Bonca
557
Nearly a Posting Maven
Mitja Bonca
557
Nearly a Posting Maven
TrustyTony
commented:
Don't spoonfeed solutions.
-3
Mitja Bonca
557
Nearly a Posting Maven
TrustyTony
888
pyMod
Team Colleague
Featured Poster
Mitja Bonca
557
Nearly a Posting Maven
TrustyTony
888
pyMod
Team Colleague
Featured Poster
Mitja Bonca
557
Nearly a Posting Maven
sherinpoulose
0
Light Poster
sherinpoulose
0
Light Poster
Mitja Bonca
557
Nearly a Posting Maven
sherinpoulose
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.