deepgram / kur

Descriptive Deep Learning
Apache License 2.0
814 stars 107 forks source link

Input CSV #81

Closed snapo closed 6 years ago

snapo commented 6 years ago

Hi, First of all thanks for kur... i really appreciate that it is so easy to use/adjust (im not a math engineer) :-)

In the tensorflow documentation i see that it is possible to read from csv files directly. Sample:

 filename_queue = tf.train.string_input_producer(["file0.csv", "file1.csv"])

 reader = tf.TextLineReader()
 key, value = reader.read(filename_queue)

 # Default values, in case of empty columns. Also specifies the type of the
 # decoded result.
 record_defaults = [[1], [1], [1], [1], [1]]
 col1, col2, col3, col4, col5 = tf.decode_csv(
     value, record_defaults=record_defaults)
 features = tf.stack([col1, col2, col3, col4])

 with tf.Session() as sess:
   # Start populating the filename queue.
   coord = tf.train.Coordinator()
   threads = tf.train.start_queue_runners(coord=coord)

   for i in range(1200):
     # Retrieve a single instance:
     example, label = sess.run([features, col5])

   coord.request_stop()
   coord.join(threads)

This is the code im using in keras:

# load dataset
dataset = np.genfromtxt ('snapo.csv', delimiter=",")
X = dataset[:,0:263].astype(float)
Y = dataset[:,264]

print("Value we are looking for: ")
print(Y[0])

Y = np_utils.to_categorical(Y, num_classes=None)

How would something like this be in kur? Or is there some other documentation on the parameters input in the yml file? I wasnt able to figure it out with: https://kur.deepgram.com/specification.html?highlight=csv#hooks my csv has about 100 values where the last value is a category that i want to predict.

If you have any hints where to look for i would really appreciate some help or a sample.

Thank you.

scottstephenson commented 6 years ago

There is a CSV supplier for Kur. Check out more details at:

http://kur.deepgram.com/specification.html?highlight=csv

snapo commented 6 years ago

Thanks, i dont know how i could miss that, as i really tried to search for it first. It works great....

Do you know if its possible to have multiple outputs ?

input1,input2,input3,input4,category_1,category_2,category_3....
input1,input2,input3,input4,category_1,category_2,category_3....
input1,input2,input3,input4,category_1,category_2,category_3....

and how would the error detection then be estimated? for example each category can have 0-1 ...

is this even possible?

ajsyp commented 6 years ago

It is definitely possible to have multiple outputs in Kur! First, take a look at a StackOverflow question I answered: https://stackoverflow.com/a/42283968/2200851. Then all that is left for multi-output models is to define a loss function for each output. (Note: output layers are defined as: the last layer in a model, any layers with sink: yes, or any output layers).