{"action":"opened","issue":{"url":"https://api.github.com/repos/tflearn/tflearn/issues/410","repository_url":"https://api.github.com/repos/tflearn/tflearn","labels_url":"https://api.github.com/repos/tflearn/tflearn/issues/410/labels{/name}","comments_url":"https://api.github.com/repos/tflearn/tflearn/issues/410/comments","events_url":"https://api.github.com/repos/tflearn/tflearn/issues/410/events","html_url":"https://github.com/tflearn/tflearn/issues/410","id":184495876,"number":410,"title":"Shape issue with data","user":{"login":"ankuj","id":1647763,"avatar_url":"https://avatars.githubusercontent.com/u/1647763?v=3","gravatar_id":"","url":"https://api.github.com/users/ankuj","html_url":"https://github.com/ankuj","followers_url":"https://api.github.com/users/ankuj/followers","following_url":"https://api.github.com/users/ankuj/following{/other_user}","gists_url":"https://api.github.com/users/ankuj/gists{/gist_id}","starred_url":"https://api.github.com/users/ankuj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ankuj/subscriptions","organizations_url":"https://api.github.com/users/ankuj/orgs","repos_url":"https://api.github.com/users/ankuj/repos","events_url":"https://api.github.com/users/ankuj/events{/privacy}","received_events_url":"https://api.github.com/users/ankuj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-21T14:15:09Z","updated_at":"2016-10-21T14:15:09Z","closed_at":null,"body":"Hello,\r\n\r\nIn my dataset, I am given in the input is  a set of action sequences, each of which are executed with a different objective or goal in mind (example: if a person wants to transport an object from one place to another, they perform a sequence of actions which consists of 'initial state->lift(object, person)->load(object, car)-> lift(..) -> drive(...)-> load(...)->drop(...)->goal'). This sequence of actions constitutes a single trace for me. Each action can, however be applied in specific world states (i.e. the action 'load' can only execute when there is a car to carry it in; i.e. predicate 'isCar' is true; these predicates are otherwise called preconditions) and on execution result in a different world state (e.g. after the action 'load', the box has been loaded into the car; i.e. predicate 'boxInCar' is true; these predicates are otherwise called effects). My task here is given these traces of action sequences, to 'learn'  the underlying action model i.e. blueprint of preconditions and effects for each action. Example of an action model for action 'load' can be:\r\n\r\npreconditions: isCar(), isDriver(),isCarRunning().. etc.\r\neffects: onCar(), carMoving().. etc.\r\n\r\nIn tensorflow, assuming that I have 4 actions to learn, I am representing each action of each trace in the form of a sequence of 16 dimensional input vector representing each action. Here I construct a superset of all possible action models (i.e. all possible permutations of predicates representing preconditions and effects), and wish to test them one by one to see which is more accurate.\r\n\r\nInput Vector (assuming action1 is executed):\r\n[action1 (1)\r\naction2 (0)\r\naction3 (0)\r\naction4 (0)\r\n(preconditions of action1) (1)\r\n(effects of action1) (1)\r\n\r\n.\r\n(preconditions of action2) (0)\r\n(effects of action2) (0)\r\n.\r\n(preconditions of action3) (0)\r\n(effects of action3) (0)\r\n.\r\n(preconditions of action4) (0)\r\n(effects of action4) (0)\r\n.\r\n]\r\n\r\nand trying to predict the next action in the sequence in a one-hot encoded fashion:\r\nOutput Vector:\r\n[first_action (0)\r\nsecondAction (1)\r\nThirdAction (0)\r\nForthAction (1)]\r\n\r\n This vector is 16 dimensional (4 rows for each of the actions, rest 12 for each of the preconditions and effects of all (3 per action, thus 12 in all) ). Each time an action is executed, the vector position corresponding to the action name is set to 1, and the positions corresponding to its preconditions and effects is set to 1 as well. The rest are kept at 0.\r\n\r\n\r\nMy code is as follows:\r\n\r\n`if __name__ == '__main__':\r\n    #code to add padded data\r\n    train_input, train_output, maxTraceLength = reader_pddlCodeIssueRep.loadData()\r\n    #80% of examples in training, 20% for testing\r\n    train_input, test_input = train_input[:int(len(train_input)*0.8)], train_input[int(len(train_input)*0.8):]\r\n    print('len(train_input)','len(train_input)',len(train_input), len(test_input))\r\n    train_output, test_output = train_output[:int(len(train_output)*0.8)], train_output[int(len(train_output)*0.8):] #everything beyond 10,000\r\n    print('len(train_output)','len(test_output)',len(train_output), len(test_output))\r\n    \r\n    # Network building\r\n    net = tflearn.input_data([None, 1, 16])\r\n    net = tflearn.lstm(net, 128, dropout=0.8)\r\n    net = tflearn.fully_connected(net, 4, activation='softmax')\r\n    net = tflearn.regression(net, optimizer='adam', learning_rate=0.001,\r\n                             loss='categorical_crossentropy')\r\n    # Training\r\n    model = tflearn.DNN(net, tensorboard_verbose=0)\r\n    model.fit(train_input, train_output, validation_set=(test_input, test_output), show_metric=True,\r\n              batch_size=maxTraceLength)\r\n\r\n`\r\nAlso attached here:\r\n[codeIssueRep.txt](https://github.com/tflearn/tflearn/files/544475/codeIssueRep.txt)\r\n\r\nIssue: I seem to be falling prey to a shape issue which says `ValueError: Cannot feed value of shape (13, 16) for Tensor 'InputData/X:0', which has shape '(?, 1, 16)'`. \r\n\r\nI am a relative newbie at tensorflow and tflearn and don't have too much of ML experience behind me. I have read similar issues in the tflearn issue page (thanks to @aymericdamien for his answers, they have been very useful in clearing doubts that I have had )and ones on TensorFlow too, and feel that I am representing it correctly but my data might not be in the correct format somehow.\r\n\r\nLastly, sorry for the long post, I just tried to clarify my problem in general to give better context :)\r\nWould be very obliged if someone could help!\r\n"}}
{"actor":{"display_login":"ankuj"}}