Thank you for the response.
The ‘data’ folder is in the same folder with the assignment code.
The .csv files are fine, if I switch the files, reading the ‘wdbc-train.csv’ for testingUrl, the program fails reading this file. Always the programs process correctly the first file and fails in the second file, no matter which file it is.
Also, I can display the ‘testingData’, the problem occurs in the .map process.
The code switching the file:
const testingUrl = '/data/wdbc-train.csv';
const testingData = await tf.data.csv(testingUrl, {
columnConfigs: {
diagnosis: {islabel: true}
}
});
console.log('testingData=', await testingData);
const arrayTestingData = await testingData.toArray();
console.log('arrayTestingData=', await arrayTestingData)
// Convert the testing data into arrays in the space below.
// Note: In this case, the labels are integers, not strings.
// Therefore, there is no need to convert string labels into
// a one-hot encoded array of label values like we did in the
// Iris dataset example.
const convertedTestingData =
await testingData.map(
({xs, ys}) => {
console.log('xs:', xs, 'ys:', ys); // Check values here
return ({ xs: Object.values(xs), ys: Object.values(ys) })
}
).batch(10);
console.log('convertedTestingData=', await convertedTestingData);
const arrayconvertedTestingData = await convertedTestingData.toArray();
console.log('arrayconvertedTestingData=', await arrayconvertedTestingData);
The output and error message:
Navigated to http://127.0.0.1:8087/C1_W1_Assignment.html
C1_W1_Assignment.html:17 trainingData= s {size: null, input: r, hasHeader: true, fullColumnNames: undefined, columnNamesValidated: false, …}
C1_W1_Assignment.html:19 arrayTrainingData= (114) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, …]
C1_W1_Assignment.html:31 convertedTrainingData= i {size: null}
index-4ab31049.js:9 SyntaxError: Unexpected token ‘b’, “b6c0b0d1-9”… is not valid JSON
at JSON.parse ()
at Mi.parseValue (index-4ab31049.js:9:26389)
at Mi.get (index-4ab31049.js:9:26074)
at async aa (quill.tsx-efc8bc9b.js:2:42085)
(anonymous) @ index-4ab31049.js:9
(anonymous) @ index-4ab31049.js:9
await in (anonymous) (async)
aa @ quill.tsx-efc8bc9b.js:2
await in aa (async)
(anonymous) @ quill.tsx-efc8bc9b.js:19
Show 4 more frames
Show less
C1_W1_Assignment.html:33 arrayconvertedTrainingData= (12) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
C1_W1_Assignment.html:53 testingData= s {size: null, input: r, hasHeader: true, fullColumnNames: undefined, columnNamesValidated: false, …}
C1_W1_Assignment.html:55 arrayTestingData= (455) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, …]
C1_W1_Assignment.html:68 convertedTestingData= i {size: null}
C1_W1_Assignment.html:64 xs: undefined ys: undefined
C1_W1_Assignment.html:65 Uncaught (in promise) TypeError: Cannot convert undefined or null to object
at Function.values ()
at C1_W1_Assignment.html:65:46
at tfjs@latest:17:942499
at tfjs@latest:17:220203
at e.value (tfjs@latest:17:220344)
at e.value (tfjs@latest:17:220100)
at X5 (tfjs@latest:17:243540)
at r.transform (tfjs@latest:17:942477)
at r. (tfjs@latest:17:931911)
at h (tfjs@latest:17:2100)
(anonymous) @ C1_W1_Assignment.html:65
(anonymous) @ tfjs@latest:17
(anonymous) @ tfjs@latest:17
value @ tfjs@latest:17
value @ tfjs@latest:17
X5 @ tfjs@latest:17
(anonymous) @ tfjs@latest:17
(anonymous) @ tfjs@latest:17
h @ tfjs@latest:17
(anonymous) @ tfjs@latest:17
(anonymous) @ tfjs@latest:17
u @ tfjs@latest:17
o @ tfjs@latest:17
await in o (async)
(anonymous) @ C1_W1_Assignment.html:128