#CanSomeoneHelpWithAsgn? TheoryHeavy,NotMuchCoding. DecisionTrees. 14/20 PassedCases
1 messages · Page 1 of 1 (latest)
<@&987246717831381062> please have a look, thanks.
Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.
I'm sorry to hear that you're struggling with your assignment. However, I'm unable to provide direct assistance through DM or any other means. But I can try to help you understand the concept of decision trees and provide guidance on how to approach your assignment.
Decision trees are a popular machine learning algorithm used for classification and regression tasks. They represent a flowchart-like structure where each internal node represents a feature or attribute, each branch represents a decision rule, and each leaf node represents an outcome or prediction.
To improve your understanding of decision trees, you can start by studying the theory behind them. Familiarize yourself with concepts like entropy, information gain, and Gini index, which are used to determine the best split at each node.
Next, try implementing a basic decision tree algorithm in Java. You can start by creating classes for nodes and trees. The node class should have attributes for feature/attribute name, children nodes (if any), and outcome/prediction (for leaf nodes). The tree class should have methods for building the tree using training data and making predictions using test data.
Once you have a basic implementation ready, you can work on improving its accuracy by considering different splitting criteria or pruning techniques. You can also explore ensemble methods like random forests or gradient boosting to further enhance the performance of your decision tree model.
Remember that practice is key when it comes to understanding algorithms. Try working on smaller examples or datasets before tackling larger problems. Additionally, don't hesitate to seek help from your classmates, professor, or online resources like tutorials or forums dedicated to machine learning.
Good luck with your academic comeback!
#rules no dms
ask your question here
ok\
i have this pseudocode involving finding the best split, and using that (private) helper method i need to implement a recursive algorithm that basically builds the DecisionTree
so far i think i got the FindBestSplit method right, but there are a few things that i need help in for the recursive algorithm
is it ok if i post the pseudocode they provided us with here?
yes, but also add you actual code
I uploaded your attachments as Gist.
what
there are also other codes for this (starter code, im sending them here)
//This class holds the information of a single datapoint
public class Datum {
double[] x; //the attributes
int y; // the label
Datum(double[] x,int y) {
this.x = new double[x.length];
for (int i = 0 ; i< x.length ; i++){
this.x[i] = x[i];
}
this.y = y;
}
public String toString() {
String str= "";
int l = this.x.length;
for (int i = 0 ; i < l ; i++)
{
str = str+"x"+i+" :"+this.x[i];
}
str = str + "y :"+this.y;
return str;
}
}
this is for a single Data Item (Datum)
and this
this is the DataReader
however, i should only code in the DecisionTree class, which is this one.
ill also send the minitester, where so far i am getting 14/20 test cases right as mentioned
maybe this thing wont be too useful now cuz it requires data and thresh or wtv, which is in a separate file, but i mostly need help for the fillDTNode() method
it's best to ask some targeted questions/specific code snippets/failing tests.
Where specifically would you like some input?
ok, nvm i fixed the whole assignment, i passed all 20/20 test cases, now im just gonna look for the edge cases and ill contact if i need help