Click here to Skip to main content
15,891,136 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: What will be the time complexity and the size of subset for the following illustration in a polynomial time algorithm? Pin
Matt T Heffron5-Feb-16 14:52
professionalMatt T Heffron5-Feb-16 14:52 
GeneralRe: What will be the time complexity and the size of subset for the following illustration in a polynomial time algorithm? Pin
operan9-Mar-16 5:17
operan9-Mar-16 5:17 
QuestionAdding branch to a tree Pin
Plasticstone4-Feb-16 8:10
Plasticstone4-Feb-16 8:10 
AnswerRe: Adding branch to a tree Pin
Patrice T4-Feb-16 22:11
mvePatrice T4-Feb-16 22:11 
QuestionAlgorithm for plotting charts with more than three (3) Axis Pin
Makinde A.29-Jan-16 19:31
professionalMakinde A.29-Jan-16 19:31 
AnswerRe: Algorithm for plotting charts with more than three (3) Axis Pin
Gerry Schmitz2-Feb-16 9:36
mveGerry Schmitz2-Feb-16 9:36 
AnswerRe: Algorithm for plotting charts with more than three (3) Axis Pin
NeverJustHere4-Feb-16 23:39
NeverJustHere4-Feb-16 23:39 
QuestionPlease feedback on class Node, Tree and help to finish DecisionTreeLearning class Pin
Plasticstone28-Jan-16 10:18
Plasticstone28-Jan-16 10:18 
Hello,
Warning: my tree class does not contain links between nodes. To connect two nodes I use leafs. Parent -> Node(linking) -> Node(desired). That way I get "Parameter1" -> "0" -> "false".
Description: examples is list of string[] such that string[0] is "false" or "true" and the rest is "0" - "10" strings as attributes values. AttributesVector has Names - List<string> of attributes and Possible_values List<int> with max value of attributes (10 for all). My output is showing all possible parameters values (0, 1, 2, 3,..., 10) with response 'true' or 'false' and it should consider only the values that make any sense (attribute 1 never get value 0). I don't know why. I also get too many nodes in the tree. I have datasets that I can provide along with csv reader.

C#
private Tree DecisionTreeLearning(List<string[]> examples, AttributesVector attributes_vector, Tree default_tree)
{
    if (examples.Count() == 0)
        return default_tree;
    if (AllExamplesSameClassification(examples))
        return new Tree(new Node(examples.First()[0]));
    if (attributes_vector.Vector_length == 0)
        return MajorityValue(examples);
    string chosen_attribute = ChooseAttribute(examples, attributes_vector);
    Tree current_tree = new Tree(new Node(chosen_attribute));
    Tree current_majority_value = MajorityValue(examples);
    int chosen_attr_index = attributes_vector.Names.FindIndex(match => match == chosen_attribute);
    int temp2 = 2;
    for (int i = 0; i < attributes_vector.Possible_values[chosen_attr_index] + 1; i++)
    {
        List<string[]> matching_examples = examples.FindAll(match => match[chosen_attr_index] == i.ToString());
        List<string> new_attributes_names = new List<string> { };
        foreach (string el in attributes_vector.Names)
        {
            string temp = string.Copy(el);
            new_attributes_names.Add(temp);
        }
        new_attributes_names.RemoveAt(chosen_attr_index);
        List<int> new_list_of_possible_values = new List<int> { };
        foreach (int el in attributes_vector.Possible_values)
        {
            int temp = el;
            new_list_of_possible_values.Add(temp);
        }
        new_list_of_possible_values.RemoveAt(chosen_attr_index);
        AttributesVector new_attributes_vector = new AttributesVector(new_attributes_names, new_list_of_possible_values);
        Tree subtree = new Tree();
        subtree = DecisionTreeLearning(matching_examples, new_attributes_vector, current_majority_value);
        current_tree.AddBranch(new Tree(new Node(i.ToString())), 1);
        current_tree.AddBranch(subtree, temp2++);
        //current_tree.DisplayTree();
    }
    return current_tree;
}


modified 29-Jan-16 5:17am.

AnswerRe: Please feedback on class Node, Tree and help to finish DecisionTreeLearning class Pin
Richard MacCutchan28-Jan-16 22:31
mveRichard MacCutchan28-Jan-16 22:31 
QuestionSine wave Analysis Alogoritham Pin
haritheera28-Jan-16 6:39
haritheera28-Jan-16 6:39 
AnswerRe: Sine wave Analysis Alogoritham Pin
Chris Losinger29-Jan-16 9:51
professionalChris Losinger29-Jan-16 9:51 
GeneralRe: Sine wave Analysis Alogoritham Pin
Daniel Pfeffer30-Jan-16 23:21
professionalDaniel Pfeffer30-Jan-16 23:21 
Questioncalculating the effect of "weighted vectors" Pin
BillWoodruff23-Jan-16 14:09
professionalBillWoodruff23-Jan-16 14:09 
AnswerRe: calculating the effect of "weighted vectors" Pin
Kenneth Haugland26-Jan-16 8:16
mvaKenneth Haugland26-Jan-16 8:16 
GeneralRe: calculating the effect of "weighted vectors" Pin
BillWoodruff26-Jan-16 23:07
professionalBillWoodruff26-Jan-16 23:07 
GeneralRe: calculating the effect of "weighted vectors" Pin
Kenneth Haugland27-Jan-16 3:46
mvaKenneth Haugland27-Jan-16 3:46 
AnswerRe: calculating the effect of "weighted vectors" Pin
Daniel Pfeffer26-Jan-16 23:23
professionalDaniel Pfeffer26-Jan-16 23:23 
AnswerRe: calculating the effect of "weighted vectors" Pin
jschell27-Jan-16 9:00
jschell27-Jan-16 9:00 
GeneralRe: calculating the effect of "weighted vectors" Pin
Daniel Pfeffer27-Jan-16 22:21
professionalDaniel Pfeffer27-Jan-16 22:21 
GeneralRe: calculating the effect of "weighted vectors" Pin
jschell28-Jan-16 13:47
jschell28-Jan-16 13:47 
GeneralRe: calculating the effect of "weighted vectors" Pin
Daniel Pfeffer28-Jan-16 22:04
professionalDaniel Pfeffer28-Jan-16 22:04 
GeneralRe: calculating the effect of "weighted vectors" Pin
jschell29-Jan-16 12:11
jschell29-Jan-16 12:11 
GeneralRe: calculating the effect of "weighted vectors" Pin
Daniel Pfeffer30-Jan-16 23:07
professionalDaniel Pfeffer30-Jan-16 23:07 
GeneralRe: calculating the effect of "weighted vectors" Pin
jschell2-Feb-16 12:16
jschell2-Feb-16 12:16 
AnswerRe: calculating the effect of "weighted vectors" Pin
Roger Wright27-Jan-16 20:19
professionalRoger Wright27-Jan-16 20:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.