I´m trying to complete course " Community Detection with GDS" but at challenge Encoding categorical variables , I can´t inspect Graph with a Cypher query , inspect to know how to map CASE clause , the graph database gets empty ... and i have to run all exercises again I need to know the categorical values from "Punctuallity"
MATCH (p:Person)
SET p.PunctualityEncoding = CASE p['Punctuality']
// Map the options to a numerical value
// For example WHEN 'Something' THEN 1
END
Here is where Graph Database gets empty , even I´have executed the Cypher query one exercise before (successfully) but when "Encoding categorical variables" stars , there´s no information, nodes
Hi @p15rajan , I've received help from academy people @martin.o'hanlon to pass the lesson , but It seems in the next lessons you must to have the graph database with all new properties. try to run the script at that point only for advance at the course, then you must to begin again all and by pass this lesson , find if Punctuality property is used forward delete from Cypher statements (if is necesary)
It looks some much "to do" , but the next lessons are really good (K Means) , I've tried locally to and it works fine too
I'll be expecting the final solution to mark as course: conclude
// Set all numbers to floats - solution for 1-dataset/2-import
MATCH (p:Person)
CALL {
WITH p
UNWIND keys(p) AS key
WITH p, key, toFloat(p[key]) AS value
WHERE value IS NOT null
CALL apoc.create.setProperty(p, key, value) YIELD node
RETURN DISTINCT 'done' AS result
} IN TRANSACTIONS OF 100 rows
RETURN DISTINCT result;
And this is solution to the lesson:
MATCH (p:Person)
SET p.PunctualityEncoding = CASE p['Punctuality']
WHEN 'i am often running late' THEN 1
WHEN 'i am often early' THEN 3
WHEN 'i am always on time' THEN 5
ELSE 3 END