artificial-intelligence

Speech to Text C# Train For Better Translation

心已入冬 提交于 2019-12-24 13:03:01
问题 I need to way to make the speech to text smarter as many of the words it is just getting incorrect in the translation. I cannot find much help on adding a list of words, not commands or grammar but words to help better translate audio recording. Here is the code I found on the web, and this works, but I need to way to train, or make the engine smarter. Any ideas? Thanks. static void Main(string[] args) { // Create an in-process speech recognizer for the en-US locale. using

BFS uninformed search issue

被刻印的时光 ゝ 提交于 2019-12-24 10:17:25
问题 I am trying to avoid an infinite loop and am having trouble figuring out whats wrong. This is supposed to find a solution for a 3x2 puzzle board. I suspect the problem may be with my overridden equals method but I'm not sure. Running into two issues: 1) It keeps re-exploring already explored nodes. 2) The queue is empty before a solution is found, causing an error. Driver class: import java.util.*; public class Driver { public static void main(String[] args){ Node test = new Node(new int[]{1,

Blackjack minimax algorithm

独自空忆成欢 提交于 2019-12-24 05:12:43
问题 I am implementing a blackjack game with minimax tree which calculates the probabilities and play automatically depend on this probabilities. Assume that, we play with 1 deck and the first game dealer takes : ' 5 ' and player takes ' 5 7 ' so the total score is 12 for player. In this case, first I am trying to check all possible probabilities for player's stand decision. If player stands : My remain cards in deck like this : Structure of deck(K,V) K : card number, V: count of card {1: 4, 2: 4,

simplest MiniMax algorithm for TicTacToe AI in Java

时光毁灭记忆、已成空白 提交于 2019-12-24 04:51:50
问题 I was trying to get a grasp of MiniMax algorithm, and have read up on it. My initial approach was to implement a simple MiniMax algorithm, and then to add alpha-beta pruning. However this is my current code: public int miniMax(char[] node, int playerNum) { int victor = checkWin(node); // returns 0 if game is ongoing, 1 for p1, 2 for p2, 3 for tie. if(victor != 0) //game over . return score(victor); if(playerNum == 2) //AI { int bestVal = Integer.MIN_VALUE; int bestSpot = 0; for(int i = 0; i <

simplest MiniMax algorithm for TicTacToe AI in Java

时光毁灭记忆、已成空白 提交于 2019-12-24 04:51:01
问题 I was trying to get a grasp of MiniMax algorithm, and have read up on it. My initial approach was to implement a simple MiniMax algorithm, and then to add alpha-beta pruning. However this is my current code: public int miniMax(char[] node, int playerNum) { int victor = checkWin(node); // returns 0 if game is ongoing, 1 for p1, 2 for p2, 3 for tie. if(victor != 0) //game over . return score(victor); if(playerNum == 2) //AI { int bestVal = Integer.MIN_VALUE; int bestSpot = 0; for(int i = 0; i <

Using cuts in prolog to select facts from database

坚强是说给别人听的谎言 提交于 2019-12-24 03:59:12
问题 I'm supposed to use Prolog cuts to get the first , the second and the last fact from the facts database , I found a way to get the first and the second but I can't find a solution for retrieving the last fact here is an example : P(jack). P(john). P(alice). P(sarah). P(kyle). Selecting the first fact only : first(X):-P(X),!. Selecting the second fact only : second(Y):-P(X),P(Y),X\=Y,P(Y),!. Selecting the last fact only : ? 回答1: I can't see a way without using negation, an accumulator, and the

How to calculate Categorical Cross-Entropy by hand?

不打扰是莪最后的温柔 提交于 2019-12-24 03:37:59
问题 When I calculate Binary Crossentropy by hand I apply sigmoid to get probabilities, then use Cross-Entropy formula and mean the result: logits = tf.constant([-1, -1, 0, 1, 2.]) labels = tf.constant([0, 0, 1, 1, 1.]) probs = tf.nn.sigmoid(logits) loss = labels * (-tf.math.log(probs)) + (1 - labels) * (-tf.math.log(1 - probs)) print(tf.reduce_mean(loss).numpy()) # 0.35197204 cross_entropy = tf.keras.losses.BinaryCrossentropy(from_logits=True) loss = cross_entropy(labels, logits) print(loss.numpy

Better way to implement a Machine Learning algorithm in Python

这一生的挚爱 提交于 2019-12-24 03:18:37
问题 I am doing some web scraping. One of the problems I have run into is that the column headings of the tables I am scraping sometimes differ in their language just enough that I am trying to use fuzzywuzzy to check their 'nearness' My program starts with a list of labels. These labels are all of the column headings from the tables I have scraped off of the web. It also requires that I assign 'normalized column headings' to at least some - these serve as the basis for the 'learning' matched

Re-train model with new classes

故事扮演 提交于 2019-12-24 01:19:30
问题 I have built an image classifier with 2 classes, say 'A' and 'B'. I have also saved this model, using model.save(). Now, after a certain time, the requirement arose to add one more class 'C'. Is it possible to load_model() and then add only one class to the previously saved model so that we have the final model with 3 classes ('A','B' and 'C'), without having to retrain the whole model, for classes 'A and 'B' again? Can anyone help? I have tried this: I used vgg16 as a base model and pop out

How to store visited states in iterative deepening / depth limited search?

左心房为你撑大大i 提交于 2019-12-23 21:50:34
问题 Update: Search for the first solution. for a normal Depth First Search it is simple, just use a hashset bool DFS (currentState) = { if (myHashSet.Contains(currentState)) { return; } else { myHashSet.Add(currentState); } if (IsSolution(currentState) return true; else { for (var nextState in GetNextStates(currentState)) if (DFS(nextState)) return true; } return false; } However, when it becomes depth limited, i cannot simply do this bool DFS (currentState, maxDepth) = { if (maxDepth = 0) return