Help with my training dataSKNN regression problemWhat ML/DL approach better suits this problem?Categorical Variable Reduction using NNTensorflow regression predicting 1 for all inputsNeural network accuracy for simple classificationSimple prediction with KerasTraining Accuracy stuck in KerasSteps taking too long to completeSolving an ODE using neural networks (via Tensorflow)Something is disastrously wrong with my neural network and what it's produced
How can I practically buy stocks?
Why doesn't the standard consider a template constructor as a copy constructor?
A strange hotel
How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?
What to do with someone that cheated their way through university and a PhD program?
Why does Arg'[1. + I] return -0.5?
Is Electric Central Heating worth it if using Solar Panels?
Contradiction proof for inequality of P and NP?
How to keep bees out of canned beverages?
Where was the County of Thurn und Taxis located?
How to find the stem of any word?
How can I wire a 9-position switch so that each position turns on one more LED than the one before?
Has a Nobel Peace laureate ever been accused of war crimes?
Co-worker works way more than he should
Air bladders in bat-like skin wings for better lift?
Check if a string is entirely made of the same substring
What is the best way to deal with NPC-NPC combat?
How much of a wave function must reside inside event horizon for it to be consumed by the black hole?
Crossed out red box fitting tightly around image
Does Mathematica have an implementation of the Poisson binomial distribution?
How do I produce this symbol: Ϟ in pdfLaTeX?
Prove that the countable union of countable sets is also countable
Conditionally enable edit in lightning:datatable
Why must Chinese maps be obfuscated?
Help with my training data
SKNN regression problemWhat ML/DL approach better suits this problem?Categorical Variable Reduction using NNTensorflow regression predicting 1 for all inputsNeural network accuracy for simple classificationSimple prediction with KerasTraining Accuracy stuck in KerasSteps taking too long to completeSolving an ODE using neural networks (via Tensorflow)Something is disastrously wrong with my neural network and what it's produced
$begingroup$
I'm working on my first NN following a tensorflow tut and trying to use my own data.
After about 80 attempts of formatting my data and trying to load it into a dataset to train I'm throwing the towel.
Here is how my data currently looks
syslog_data = [
[302014,0,0,63878,30,3,1], [302014,0,0,3891,0,0,0], [302014,0,0,15928,0,0,2], [305013,5,0,123,99999,0,3],
[302014,0,0,5185,0,0,0], [305013,5,0,123,99999,0,3], [302014,0,0,56085,0,0,0], [110002,4,2,50074,99999,0,4],
In this the last item in each list is the label.
If you can tell me if I need to reformat my data and how or just how to get it loaded into a dataset properly.
Thanks for any help or advice you can give
Here is the full code:
import tensorflow as tf
import numpy as np
from tensorflow.keras import layers
from . import syslog
print(tf.VERSION)
print(tf.keras.__version__)
model = tf.keras.Sequential()
# Adds a densely-connected layer with 64 units to the model:
model.add(layers.Dense(64, activation='relu'))
# Add another:
model.add(layers.Dense(64, activation='relu'))
# Add a softmax layer with 10 output units:
model.add(layers.Dense(10, activation='softmax'))
model.compile(optimizer=tf.train.AdamOptimizer(0.001),
loss='categorical_crossentropy',
metrics=['accuracy'])
dataset = tf.data.dataset.from_tensor_slices(syslog)
model.fit(dataset, epochs=10, steps_per_epoch=30)
python tensorflow
New contributor
Alex F is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
add a comment |
$begingroup$
I'm working on my first NN following a tensorflow tut and trying to use my own data.
After about 80 attempts of formatting my data and trying to load it into a dataset to train I'm throwing the towel.
Here is how my data currently looks
syslog_data = [
[302014,0,0,63878,30,3,1], [302014,0,0,3891,0,0,0], [302014,0,0,15928,0,0,2], [305013,5,0,123,99999,0,3],
[302014,0,0,5185,0,0,0], [305013,5,0,123,99999,0,3], [302014,0,0,56085,0,0,0], [110002,4,2,50074,99999,0,4],
In this the last item in each list is the label.
If you can tell me if I need to reformat my data and how or just how to get it loaded into a dataset properly.
Thanks for any help or advice you can give
Here is the full code:
import tensorflow as tf
import numpy as np
from tensorflow.keras import layers
from . import syslog
print(tf.VERSION)
print(tf.keras.__version__)
model = tf.keras.Sequential()
# Adds a densely-connected layer with 64 units to the model:
model.add(layers.Dense(64, activation='relu'))
# Add another:
model.add(layers.Dense(64, activation='relu'))
# Add a softmax layer with 10 output units:
model.add(layers.Dense(10, activation='softmax'))
model.compile(optimizer=tf.train.AdamOptimizer(0.001),
loss='categorical_crossentropy',
metrics=['accuracy'])
dataset = tf.data.dataset.from_tensor_slices(syslog)
model.fit(dataset, epochs=10, steps_per_epoch=30)
python tensorflow
New contributor
Alex F is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
$begingroup$
WElcome to Data Science SE! Which tutorial did you follow? What error are you actually getting? Have you read the Keras documentation? Or the relevant Tensorflow docs for from_tensor_slices?
$endgroup$
– n1k31t4
51 mins ago
$begingroup$
Ive followed about 15 :/ but this one is the most relevant tensorflow.org/guide/keras I have received a number of errors from different attempts. the most recent is this - got shape [8972], but wanted [8972, 1]. from this code dataset = tf.data.Dataset.from_tensor_slices((data, labels)). Im pretty lost on what my training data should look like and how i should import it.
$endgroup$
– Alex F
44 mins ago
$begingroup$
I can reformat as needed, I just dont know what to do
$endgroup$
– Alex F
42 mins ago
add a comment |
$begingroup$
I'm working on my first NN following a tensorflow tut and trying to use my own data.
After about 80 attempts of formatting my data and trying to load it into a dataset to train I'm throwing the towel.
Here is how my data currently looks
syslog_data = [
[302014,0,0,63878,30,3,1], [302014,0,0,3891,0,0,0], [302014,0,0,15928,0,0,2], [305013,5,0,123,99999,0,3],
[302014,0,0,5185,0,0,0], [305013,5,0,123,99999,0,3], [302014,0,0,56085,0,0,0], [110002,4,2,50074,99999,0,4],
In this the last item in each list is the label.
If you can tell me if I need to reformat my data and how or just how to get it loaded into a dataset properly.
Thanks for any help or advice you can give
Here is the full code:
import tensorflow as tf
import numpy as np
from tensorflow.keras import layers
from . import syslog
print(tf.VERSION)
print(tf.keras.__version__)
model = tf.keras.Sequential()
# Adds a densely-connected layer with 64 units to the model:
model.add(layers.Dense(64, activation='relu'))
# Add another:
model.add(layers.Dense(64, activation='relu'))
# Add a softmax layer with 10 output units:
model.add(layers.Dense(10, activation='softmax'))
model.compile(optimizer=tf.train.AdamOptimizer(0.001),
loss='categorical_crossentropy',
metrics=['accuracy'])
dataset = tf.data.dataset.from_tensor_slices(syslog)
model.fit(dataset, epochs=10, steps_per_epoch=30)
python tensorflow
New contributor
Alex F is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
I'm working on my first NN following a tensorflow tut and trying to use my own data.
After about 80 attempts of formatting my data and trying to load it into a dataset to train I'm throwing the towel.
Here is how my data currently looks
syslog_data = [
[302014,0,0,63878,30,3,1], [302014,0,0,3891,0,0,0], [302014,0,0,15928,0,0,2], [305013,5,0,123,99999,0,3],
[302014,0,0,5185,0,0,0], [305013,5,0,123,99999,0,3], [302014,0,0,56085,0,0,0], [110002,4,2,50074,99999,0,4],
In this the last item in each list is the label.
If you can tell me if I need to reformat my data and how or just how to get it loaded into a dataset properly.
Thanks for any help or advice you can give
Here is the full code:
import tensorflow as tf
import numpy as np
from tensorflow.keras import layers
from . import syslog
print(tf.VERSION)
print(tf.keras.__version__)
model = tf.keras.Sequential()
# Adds a densely-connected layer with 64 units to the model:
model.add(layers.Dense(64, activation='relu'))
# Add another:
model.add(layers.Dense(64, activation='relu'))
# Add a softmax layer with 10 output units:
model.add(layers.Dense(10, activation='softmax'))
model.compile(optimizer=tf.train.AdamOptimizer(0.001),
loss='categorical_crossentropy',
metrics=['accuracy'])
dataset = tf.data.dataset.from_tensor_slices(syslog)
model.fit(dataset, epochs=10, steps_per_epoch=30)
python tensorflow
python tensorflow
New contributor
Alex F is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Alex F is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 40 mins ago
Juan Esteban de la Calle
68922
68922
New contributor
Alex F is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 1 hour ago
Alex FAlex F
83
83
New contributor
Alex F is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Alex F is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Alex F is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$begingroup$
WElcome to Data Science SE! Which tutorial did you follow? What error are you actually getting? Have you read the Keras documentation? Or the relevant Tensorflow docs for from_tensor_slices?
$endgroup$
– n1k31t4
51 mins ago
$begingroup$
Ive followed about 15 :/ but this one is the most relevant tensorflow.org/guide/keras I have received a number of errors from different attempts. the most recent is this - got shape [8972], but wanted [8972, 1]. from this code dataset = tf.data.Dataset.from_tensor_slices((data, labels)). Im pretty lost on what my training data should look like and how i should import it.
$endgroup$
– Alex F
44 mins ago
$begingroup$
I can reformat as needed, I just dont know what to do
$endgroup$
– Alex F
42 mins ago
add a comment |
$begingroup$
WElcome to Data Science SE! Which tutorial did you follow? What error are you actually getting? Have you read the Keras documentation? Or the relevant Tensorflow docs for from_tensor_slices?
$endgroup$
– n1k31t4
51 mins ago
$begingroup$
Ive followed about 15 :/ but this one is the most relevant tensorflow.org/guide/keras I have received a number of errors from different attempts. the most recent is this - got shape [8972], but wanted [8972, 1]. from this code dataset = tf.data.Dataset.from_tensor_slices((data, labels)). Im pretty lost on what my training data should look like and how i should import it.
$endgroup$
– Alex F
44 mins ago
$begingroup$
I can reformat as needed, I just dont know what to do
$endgroup$
– Alex F
42 mins ago
$begingroup$
WElcome to Data Science SE! Which tutorial did you follow? What error are you actually getting? Have you read the Keras documentation? Or the relevant Tensorflow docs for from_tensor_slices?
$endgroup$
– n1k31t4
51 mins ago
$begingroup$
WElcome to Data Science SE! Which tutorial did you follow? What error are you actually getting? Have you read the Keras documentation? Or the relevant Tensorflow docs for from_tensor_slices?
$endgroup$
– n1k31t4
51 mins ago
$begingroup$
Ive followed about 15 :/ but this one is the most relevant tensorflow.org/guide/keras I have received a number of errors from different attempts. the most recent is this - got shape [8972], but wanted [8972, 1]. from this code dataset = tf.data.Dataset.from_tensor_slices((data, labels)). Im pretty lost on what my training data should look like and how i should import it.
$endgroup$
– Alex F
44 mins ago
$begingroup$
Ive followed about 15 :/ but this one is the most relevant tensorflow.org/guide/keras I have received a number of errors from different attempts. the most recent is this - got shape [8972], but wanted [8972, 1]. from this code dataset = tf.data.Dataset.from_tensor_slices((data, labels)). Im pretty lost on what my training data should look like and how i should import it.
$endgroup$
– Alex F
44 mins ago
$begingroup$
I can reformat as needed, I just dont know what to do
$endgroup$
– Alex F
42 mins ago
$begingroup$
I can reformat as needed, I just dont know what to do
$endgroup$
– Alex F
42 mins ago
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
There are a couple of problems and things you might want to add to your existing script.
Below I separate your example data into two NumPy arrays:
- input values
x - labels
y
It is also important to make sure they are of type float32, because Tensorflow will complain if you pass it integers (as they otherwise would be interpreted).
The following works for me, the model trains to completion:
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
syslog_data = [
[302014, 0, 0, 63878, 30, 3, 1],
[302014, 0, 0, 3891, 0, 0, 0],
[302014, 0, 0, 15928, 0, 0, 2],
[305013, 5, 0, 123, 99999, 0, 3],
[302014, 0, 0, 5185, 0, 0, 0],
[305013, 5, 0, 123, 99999, 0, 3],
[302014, 0, 0, 56085, 0, 0, 0],
[110002, 4, 2, 50074, 99999, 0, 4],
]
print(tf.VERSION)
print(tf.keras.__version__)
x = np.array([arr[:-1] for arr in syslog_data], dtype=np.float32)
y = np.array([arr[-1:] for arr in syslog_data], dtype=np.float32)
model = tf.keras.Sequential()
# Adds a densely-connected layer with 64 units to the model:
model.add(layers.Dense(64, activation="relu"))
# Add another:
model.add(layers.Dense(64, activation="relu"))
# Add a softmax layer with 10 output units:
model.add(layers.Dense(10, activation="softmax"))
model.compile(optimizer=tf.train.AdamOptimizer(0.001), loss="categorical_crossentropy", metrics=["accuracy"])
model.fit(x, y, epochs=10, steps_per_epoch=30)
$endgroup$
$begingroup$
I know we just met but I love you
$endgroup$
– Alex F
29 mins ago
add a comment |
$begingroup$
import keras
import numpy as np
full_data = np.array(syslog_data)
X = full_data[:,:6]
Y = full_data[:,6]
# Convert labels to categorical one-hot encoding
one_hot_labels = keras.utils.to_categorical(Y, num_classes=10)
model.fit(X,Y, epochs=10, steps_per_epoch=30)
Does this work? I think I might be misunderstanding the problem.
$endgroup$
$begingroup$
I didnt under stand that it needed to be an array, thank you for replying
$endgroup$
– Alex F
28 mins ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "557"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Alex F is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f50934%2fhelp-with-my-training-data%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
There are a couple of problems and things you might want to add to your existing script.
Below I separate your example data into two NumPy arrays:
- input values
x - labels
y
It is also important to make sure they are of type float32, because Tensorflow will complain if you pass it integers (as they otherwise would be interpreted).
The following works for me, the model trains to completion:
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
syslog_data = [
[302014, 0, 0, 63878, 30, 3, 1],
[302014, 0, 0, 3891, 0, 0, 0],
[302014, 0, 0, 15928, 0, 0, 2],
[305013, 5, 0, 123, 99999, 0, 3],
[302014, 0, 0, 5185, 0, 0, 0],
[305013, 5, 0, 123, 99999, 0, 3],
[302014, 0, 0, 56085, 0, 0, 0],
[110002, 4, 2, 50074, 99999, 0, 4],
]
print(tf.VERSION)
print(tf.keras.__version__)
x = np.array([arr[:-1] for arr in syslog_data], dtype=np.float32)
y = np.array([arr[-1:] for arr in syslog_data], dtype=np.float32)
model = tf.keras.Sequential()
# Adds a densely-connected layer with 64 units to the model:
model.add(layers.Dense(64, activation="relu"))
# Add another:
model.add(layers.Dense(64, activation="relu"))
# Add a softmax layer with 10 output units:
model.add(layers.Dense(10, activation="softmax"))
model.compile(optimizer=tf.train.AdamOptimizer(0.001), loss="categorical_crossentropy", metrics=["accuracy"])
model.fit(x, y, epochs=10, steps_per_epoch=30)
$endgroup$
$begingroup$
I know we just met but I love you
$endgroup$
– Alex F
29 mins ago
add a comment |
$begingroup$
There are a couple of problems and things you might want to add to your existing script.
Below I separate your example data into two NumPy arrays:
- input values
x - labels
y
It is also important to make sure they are of type float32, because Tensorflow will complain if you pass it integers (as they otherwise would be interpreted).
The following works for me, the model trains to completion:
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
syslog_data = [
[302014, 0, 0, 63878, 30, 3, 1],
[302014, 0, 0, 3891, 0, 0, 0],
[302014, 0, 0, 15928, 0, 0, 2],
[305013, 5, 0, 123, 99999, 0, 3],
[302014, 0, 0, 5185, 0, 0, 0],
[305013, 5, 0, 123, 99999, 0, 3],
[302014, 0, 0, 56085, 0, 0, 0],
[110002, 4, 2, 50074, 99999, 0, 4],
]
print(tf.VERSION)
print(tf.keras.__version__)
x = np.array([arr[:-1] for arr in syslog_data], dtype=np.float32)
y = np.array([arr[-1:] for arr in syslog_data], dtype=np.float32)
model = tf.keras.Sequential()
# Adds a densely-connected layer with 64 units to the model:
model.add(layers.Dense(64, activation="relu"))
# Add another:
model.add(layers.Dense(64, activation="relu"))
# Add a softmax layer with 10 output units:
model.add(layers.Dense(10, activation="softmax"))
model.compile(optimizer=tf.train.AdamOptimizer(0.001), loss="categorical_crossentropy", metrics=["accuracy"])
model.fit(x, y, epochs=10, steps_per_epoch=30)
$endgroup$
$begingroup$
I know we just met but I love you
$endgroup$
– Alex F
29 mins ago
add a comment |
$begingroup$
There are a couple of problems and things you might want to add to your existing script.
Below I separate your example data into two NumPy arrays:
- input values
x - labels
y
It is also important to make sure they are of type float32, because Tensorflow will complain if you pass it integers (as they otherwise would be interpreted).
The following works for me, the model trains to completion:
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
syslog_data = [
[302014, 0, 0, 63878, 30, 3, 1],
[302014, 0, 0, 3891, 0, 0, 0],
[302014, 0, 0, 15928, 0, 0, 2],
[305013, 5, 0, 123, 99999, 0, 3],
[302014, 0, 0, 5185, 0, 0, 0],
[305013, 5, 0, 123, 99999, 0, 3],
[302014, 0, 0, 56085, 0, 0, 0],
[110002, 4, 2, 50074, 99999, 0, 4],
]
print(tf.VERSION)
print(tf.keras.__version__)
x = np.array([arr[:-1] for arr in syslog_data], dtype=np.float32)
y = np.array([arr[-1:] for arr in syslog_data], dtype=np.float32)
model = tf.keras.Sequential()
# Adds a densely-connected layer with 64 units to the model:
model.add(layers.Dense(64, activation="relu"))
# Add another:
model.add(layers.Dense(64, activation="relu"))
# Add a softmax layer with 10 output units:
model.add(layers.Dense(10, activation="softmax"))
model.compile(optimizer=tf.train.AdamOptimizer(0.001), loss="categorical_crossentropy", metrics=["accuracy"])
model.fit(x, y, epochs=10, steps_per_epoch=30)
$endgroup$
There are a couple of problems and things you might want to add to your existing script.
Below I separate your example data into two NumPy arrays:
- input values
x - labels
y
It is also important to make sure they are of type float32, because Tensorflow will complain if you pass it integers (as they otherwise would be interpreted).
The following works for me, the model trains to completion:
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
syslog_data = [
[302014, 0, 0, 63878, 30, 3, 1],
[302014, 0, 0, 3891, 0, 0, 0],
[302014, 0, 0, 15928, 0, 0, 2],
[305013, 5, 0, 123, 99999, 0, 3],
[302014, 0, 0, 5185, 0, 0, 0],
[305013, 5, 0, 123, 99999, 0, 3],
[302014, 0, 0, 56085, 0, 0, 0],
[110002, 4, 2, 50074, 99999, 0, 4],
]
print(tf.VERSION)
print(tf.keras.__version__)
x = np.array([arr[:-1] for arr in syslog_data], dtype=np.float32)
y = np.array([arr[-1:] for arr in syslog_data], dtype=np.float32)
model = tf.keras.Sequential()
# Adds a densely-connected layer with 64 units to the model:
model.add(layers.Dense(64, activation="relu"))
# Add another:
model.add(layers.Dense(64, activation="relu"))
# Add a softmax layer with 10 output units:
model.add(layers.Dense(10, activation="softmax"))
model.compile(optimizer=tf.train.AdamOptimizer(0.001), loss="categorical_crossentropy", metrics=["accuracy"])
model.fit(x, y, epochs=10, steps_per_epoch=30)
answered 32 mins ago
n1k31t4n1k31t4
6,6812421
6,6812421
$begingroup$
I know we just met but I love you
$endgroup$
– Alex F
29 mins ago
add a comment |
$begingroup$
I know we just met but I love you
$endgroup$
– Alex F
29 mins ago
$begingroup$
I know we just met but I love you
$endgroup$
– Alex F
29 mins ago
$begingroup$
I know we just met but I love you
$endgroup$
– Alex F
29 mins ago
add a comment |
$begingroup$
import keras
import numpy as np
full_data = np.array(syslog_data)
X = full_data[:,:6]
Y = full_data[:,6]
# Convert labels to categorical one-hot encoding
one_hot_labels = keras.utils.to_categorical(Y, num_classes=10)
model.fit(X,Y, epochs=10, steps_per_epoch=30)
Does this work? I think I might be misunderstanding the problem.
$endgroup$
$begingroup$
I didnt under stand that it needed to be an array, thank you for replying
$endgroup$
– Alex F
28 mins ago
add a comment |
$begingroup$
import keras
import numpy as np
full_data = np.array(syslog_data)
X = full_data[:,:6]
Y = full_data[:,6]
# Convert labels to categorical one-hot encoding
one_hot_labels = keras.utils.to_categorical(Y, num_classes=10)
model.fit(X,Y, epochs=10, steps_per_epoch=30)
Does this work? I think I might be misunderstanding the problem.
$endgroup$
$begingroup$
I didnt under stand that it needed to be an array, thank you for replying
$endgroup$
– Alex F
28 mins ago
add a comment |
$begingroup$
import keras
import numpy as np
full_data = np.array(syslog_data)
X = full_data[:,:6]
Y = full_data[:,6]
# Convert labels to categorical one-hot encoding
one_hot_labels = keras.utils.to_categorical(Y, num_classes=10)
model.fit(X,Y, epochs=10, steps_per_epoch=30)
Does this work? I think I might be misunderstanding the problem.
$endgroup$
import keras
import numpy as np
full_data = np.array(syslog_data)
X = full_data[:,:6]
Y = full_data[:,6]
# Convert labels to categorical one-hot encoding
one_hot_labels = keras.utils.to_categorical(Y, num_classes=10)
model.fit(X,Y, epochs=10, steps_per_epoch=30)
Does this work? I think I might be misunderstanding the problem.
answered 29 mins ago
Andy MAndy M
913
913
$begingroup$
I didnt under stand that it needed to be an array, thank you for replying
$endgroup$
– Alex F
28 mins ago
add a comment |
$begingroup$
I didnt under stand that it needed to be an array, thank you for replying
$endgroup$
– Alex F
28 mins ago
$begingroup$
I didnt under stand that it needed to be an array, thank you for replying
$endgroup$
– Alex F
28 mins ago
$begingroup$
I didnt under stand that it needed to be an array, thank you for replying
$endgroup$
– Alex F
28 mins ago
add a comment |
Alex F is a new contributor. Be nice, and check out our Code of Conduct.
Alex F is a new contributor. Be nice, and check out our Code of Conduct.
Alex F is a new contributor. Be nice, and check out our Code of Conduct.
Alex F is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Data Science Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f50934%2fhelp-with-my-training-data%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
WElcome to Data Science SE! Which tutorial did you follow? What error are you actually getting? Have you read the Keras documentation? Or the relevant Tensorflow docs for from_tensor_slices?
$endgroup$
– n1k31t4
51 mins ago
$begingroup$
Ive followed about 15 :/ but this one is the most relevant tensorflow.org/guide/keras I have received a number of errors from different attempts. the most recent is this - got shape [8972], but wanted [8972, 1]. from this code dataset = tf.data.Dataset.from_tensor_slices((data, labels)). Im pretty lost on what my training data should look like and how i should import it.
$endgroup$
– Alex F
44 mins ago
$begingroup$
I can reformat as needed, I just dont know what to do
$endgroup$
– Alex F
42 mins ago