artificial-intelligence

Why should weights of Neural Networks be initialized to random numbers?

梦想与她 提交于 2019-11-26 21:18:11
I am trying to build a neural network from scratch. Across all AI literature there is a consensus that weights should be initialized to random numbers in order for the network to converge faster. But why are neural networks initial weights initialized as random numbers? I had read somewhere that this is done to "break the symmetry" and this makes the neural network learn faster. How does breaking the symmetry make it learn faster? Wouldn't initializing the weights to 0 be a better idea? That way the weights would be able to find their values (whether positive or negative) faster? Is there some

How can I split a text into sentences using the Stanford parser?

江枫思渺然 提交于 2019-11-26 19:56:45
How can I split a text or paragraph into sentences using Stanford parser ? Is there any method that can extract sentences, such as getSentencesFromString() as it's provided for Ruby ? Kenston Choi You can check the DocumentPreprocessor class. Below is a short snippet. I think there may be other ways to do what you want. String paragraph = "My 1st sentence. “Does it work for questions?” My third sentence."; Reader reader = new StringReader(paragraph); DocumentPreprocessor dp = new DocumentPreprocessor(reader); List<String> sentenceList = new ArrayList<String>(); for (List<HasWord> sentence : dp

Meaning of an Epoch in Neural Networks Training

穿精又带淫゛_ 提交于 2019-11-26 18:55:23
问题 while I'm reading in how to build ANN in pybrain, they say: Train the network for some epochs. Usually you would set something like 5 here, trainer.trainEpochs( 1 ) I looked for what is that mean , then I conclude that we use an epoch of data to update weights, If I choose to train the data with 5 epochs as pybrain advice, the dataset will be divided into 5 subsets, and the wights will update 5 times as maximum. I'm familiar with online training where the wights are updated after each sample

How to compute precision, recall, accuracy and f1-score for the multiclass case with scikit learn?

我怕爱的太早我们不能终老 提交于 2019-11-26 18:44:14
问题 I'm working in a sentiment analysis problem the data looks like this: label instances 5 1190 4 838 3 239 1 204 2 127 So my data is unbalanced since 1190 instances are labeled with 5 . For the classification Im using scikit's SVC. The problem is I do not know how to balance my data in the right way in order to compute accurately the precision, recall, accuracy and f1-score for the multiclass case. So I tried the following approaches: First: wclf = SVC(kernel='linear', C= 1, class_weight={1: 10

Estimating the number of neurons and number of layers of an artificial neural network [closed]

半世苍凉 提交于 2019-11-26 18:43:54
问题 I am looking for a method on how to calculate the number of layers and the number of neurons per layer. As input I only have the size of the input vector, the size of the output vector and the size of the training set. Usually the best net is determined by trying different net topologies and selecting the one with the least error. Unfortunately I cannot do that. 回答1: This is a really hard problem. The more internal structure a network has, the better that network will be at representing

Neural network XOR gate not learning

扶醉桌前 提交于 2019-11-26 17:52:00
问题 I'm trying to make a XOR gate by using 2 perceptron network but for some reason the network is not learning, when I plot the change of error in a graph the error comes to a static level and oscillates in that region. I did not add any bias to the network at the moment. import numpy as np def S(x): return 1/(1+np.exp(-x)) win = np.random.randn(2,2) wout = np.random.randn(2,1) eta = 0.15 # win = [[1,1], [2,2]] # wout = [[1],[2]] obj = [[0,0],[1,0],[0,1],[1,1]] target = [0,1,1,0] epoch = int

Store orientation to an array - and compare

落花浮王杯 提交于 2019-11-26 17:32:19
I want to achieve the following: I want the user to be able to "record" the movement of the iPhone using the gyroscope. And after that, the user should be able to replicate the same movement. I extract the pitch, roll and yaw using: [self.motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue currentQueue] withHandler: ^(CMDeviceMotion *motion, NSError *error) { CMAttitude *attitude = motion.attitude; NSLog(@"pitch: %f, roll: %f, yaw: %f]", attitude.pitch, attitude.roll, attitude.yaw); }]; I'm thinking that I could store these values into an array, if the user is in record mode. And

Is it possible for a computer to “learn” a regular expression by user-provided examples?

☆樱花仙子☆ 提交于 2019-11-26 16:52:57
Is it possible for a computer to "learn" a regular expression by user-provided examples? To clarify: I do not want to learn regular expressions. I want to create a program which "learns" a regular expression from examples which are interactively provided by a user, perhaps by selecting parts from a text or selecting begin or end markers. Is it possible? Are there algorithms, keywords, etc. which I can Google for? EDIT : Thank you for the answers, but I'm not interested in tools which provide this feature. I'm looking for theoretical information, like papers, tutorials, source code, names of

What algorithm for a tic-tac-toe game can I use to determine the “best move” for the AI?

99封情书 提交于 2019-11-26 15:44:56
In a tic-tac-toe implementation I guess that the challenging part is to determine the best move to be played by the machine. What are the algorithms that can pursued? I'm looking into implementations from simple to complex. How would I go about tackling this part of the problem? bkane The strategy from Wikipedia for playing a perfect game (win or tie every time) seems like straightforward pseudo-code: Quote from Wikipedia (Tic Tac Toe#Strategy) A player can play a perfect game of Tic-tac-toe (to win or, at least, draw) if they choose the first available move from the following list, each turn,

What&#39;s is the difference between train, validation and test set, in neural networks?

痴心易碎 提交于 2019-11-26 14:49:07
I'm using this library to implement a learning agent. I have generated the training cases, but I don't know for sure what the validation and test sets are. The teacher says: 70% should be train cases, 10% will be test cases and the rest 20% should be validation cases. edit I have this code for training, but I have no idea when to stop training. def train(self, train, validation, N=0.3, M=0.1): # N: learning rate # M: momentum factor accuracy = list() while(True): error = 0.0 for p in train: input, target = p self.update(input) error = error + self.backPropagate(target, N, M) print "validation"