Click here to Skip to main content
15,886,661 members
Home / Discussions / C#
   

C#

 
QuestionUDP Packet Synchronization Pin
softwarejaeger21-Sep-10 3:42
softwarejaeger21-Sep-10 3:42 
AnswerRe: UDP Packet Synchronization Pin
Dave Kreskowiak21-Sep-10 6:41
mveDave Kreskowiak21-Sep-10 6:41 
Questionhow can i use diffrence neuron count in difference layer Pin
karayel_kara21-Sep-10 3:22
karayel_kara21-Sep-10 3:22 
AnswerRe: how can i use diffrence neuron count in difference layer Pin
Alan Balkany21-Sep-10 3:59
Alan Balkany21-Sep-10 3:59 
GeneralRe: how can i use diffrence neuron count in difference layer Pin
karayel_kara21-Sep-10 4:16
karayel_kara21-Sep-10 4:16 
GeneralRe: how can i use diffrence neuron count in difference layer Pin
Alan Balkany21-Sep-10 4:28
Alan Balkany21-Sep-10 4:28 
GeneralRe: how can i use diffrence neuron count in difference layer Pin
Alan Balkany21-Sep-10 4:32
Alan Balkany21-Sep-10 4:32 
AnswerRe: how can i use diffrence neuron count in difference layer Pin
Henry Minute21-Sep-10 4:31
Henry Minute21-Sep-10 4:31 
Firstly I hope that your knowledge of Neural Networks is greater than your knowledge of programming, otherwise I fear that this particular project is going to be beyond your capabilities. Smile | :)

Still, let's get on with a little help:

The first thing that I would do is to change your net class, something like this

C#
class net {

  public int ban, hen;
  public layer[] layers;

  public net()
  {
    layers = new layer[lay];

    for (int index = 0; index < layers.Length; index++)
    {
      layers[index] = new layer();
    }
  }

  public net(int lays)
  {
    layers = new layer[lays];

    for (int index = 0; index < layers.Length; index++)
    {
      layers[index] = new layer();
    }
  }

  ~net(){}
}


You will see that I suggest moving the instantiation of your layer[] to within the constructor. I have also added a constructor that takes an int as a parameter. With the class defined in this way:

net networks = new net(); gets you a network with the standard number of layers (whatever you have set your lay member to)

net networks = new net(25); gets you a network with 25 layers.

For your actual question I would suggest that one method would be to add yet another constructor to the net class and one in the layer class.

Firstly, layer gets the same treatment as above, for the same reason.
C#
public neuron[] noron;

public layer()
{
    noron = new neuron[nron];

    for (int index = 0; index < noron.Length; index++)
    {
        noron[index] = new neuron();
    }
}

public layer(int neurons)
{
    noron = new neuron[neurons];

    for (int index = 0; index < noron.Length; index++)
    {
        noron[index] = new neuron();
    }
}


I have just listed the new constructors.

In the net class the new constructor would look something like:
C#
  public net(int lays, int[] neuronMap)
  {
    if (neurons.Length != lays)
    {
        throw new ArgumentException("neurons");
    }

    layers = new layer[lays];

    for (int index = 0; index < layers.Length; index++)
    {
      layers[index] = new layer(neuronMap[index]);
    }
  }

  ~net(){}
}


Using the suggestions above you could then do something like:
C#
int[] neuronMap = new int[] { 6, 7, 8, 9, 10 };

net networks = new net(5, neuronMap);


This creates a net with 5 layers. The first layer will have 6 neurons, the second 7 and so on.

I hope this helps. Smile | :)
Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”

GeneralRe: how can i use diffrence neuron count in difference layer Pin
harold aptroot21-Sep-10 5:13
harold aptroot21-Sep-10 5:13 
QuestionExtensions Property Pin
reza assar21-Sep-10 3:22
reza assar21-Sep-10 3:22 
AnswerRe: Extensions Property Pin
Dave Kreskowiak21-Sep-10 3:33
mveDave Kreskowiak21-Sep-10 3:33 
GeneralRe: Extensions Property Pin
reza assar21-Sep-10 18:24
reza assar21-Sep-10 18:24 
GeneralRe: Extensions Property Pin
Dave Kreskowiak21-Sep-10 19:26
mveDave Kreskowiak21-Sep-10 19:26 
QuestionList view problem Pin
annie_bel21-Sep-10 3:16
annie_bel21-Sep-10 3:16 
AnswerMessage Closed Pin
21-Sep-10 3:36
stancrm21-Sep-10 3:36 
GeneralRe: List view problem Pin
annie_bel21-Sep-10 3:47
annie_bel21-Sep-10 3:47 
GeneralRe: List view problem Pin
John.Smith770021-Sep-10 6:28
John.Smith770021-Sep-10 6:28 
QuestionDatabase migration Pin
anishkannan21-Sep-10 1:52
anishkannan21-Sep-10 1:52 
AnswerRe: Database migration Pin
Bernhard Hiller21-Sep-10 2:11
Bernhard Hiller21-Sep-10 2:11 
GeneralRe: Database migration Pin
anishkannan21-Sep-10 2:17
anishkannan21-Sep-10 2:17 
GeneralRe: Database migration Pin
anishkannan21-Sep-10 2:17
anishkannan21-Sep-10 2:17 
QuestionCheckbox List Item Value Pin
SatyaKeerthi1520-Sep-10 23:25
SatyaKeerthi1520-Sep-10 23:25 
AnswerRe: Checkbox List Item Value Pin
Henry Minute20-Sep-10 23:30
Henry Minute20-Sep-10 23:30 
QuestionHandling mouse events in off-screen rendering Pin
HalliHaida20-Sep-10 23:04
HalliHaida20-Sep-10 23:04 
QuestionReading large data with TcpClient Pin
Chesnokov Yuriy20-Sep-10 20:47
professionalChesnokov Yuriy20-Sep-10 20:47 

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.