Home » Author Archives: Mark Needham (page 3)

Author Archives: Mark Needham

R: A first attempt at linear regression

software-development-2-logo

I’ve been working through the videos that accompany the Introduction to Statistical Learning with Applications in R book and thought it’d be interesting to try out the linear regression algorithm against my meetup data set. I wanted to see how well a linear regression algorithm could predict how many people were likely to RSVP to a particular event. I started ...

Read More »

Neo4j: Generic/Vague relationship names

neo4j-logo

An approach to modelling that I often see while working with Neo4j users is creating very generic relationships (e.g. HAS, CONTAINS, IS) and filtering on a relationship property or on a property/label at the end node. Intuitively this doesn’t seem to make best use of the graph model as it means that you have to evaluate many relationships and nodes ...

Read More »

Neo4j: COLLECTing multiple values

neo4j-logo

One of my favourite functions in Neo4j’s cypher query language is COLLECT which allows us to group items into an array for later consumption. However, I’ve noticed that people sometimes have trouble working out how to collect multiple items with COLLECT and struggle to find a way to do so. Consider the following data set:         create ...

Read More »

R: Calculating rolling or moving averages

software-development-2-logo

I’ve been playing around with some time series data in R and since there’s a bit of variation between consecutive points I wanted to smooth the data out by calculating the moving average. I struggled to find an in built function to do this but came across Didier Ruedin’s blog post which described the following function to do the job: ...

Read More »

Neo4j 2.1: Passing around node ids vs UNWIND

neo4j-logo

When Neo4j 2.1 is released we’ll have the UNWIND clause which makes working with collections of things easier. In my blog post about creating adjacency matrices we wanted to show how many people were members of the first 5 meetup groups ordered alphabetically and then check how many were members of each of the other groups.         ...

Read More »

Jersey/Jax RS: Streaming JSON

json-logo

About a year ago I wrote a blog post showing how to stream a HTTP response using Jersey/Jax RS and I recently wanted to do the same thing but this time using JSON. A common pattern is to take our Java object and get a JSON string representation of that but that isn’t the most efficient use of memory because ...

Read More »

Java 8: Lambda Expressions vs Auto Closeable

java-logo

If you used earlier versions of Neo4j via its Java API with Java 6 you probably have code similar to the following to ensure write operations happen within a transaction:                   public class StylesOfTx { public static void main( String[] args ) throws IOException { String path = "/tmp/tx-style-test"; FileUtils.deleteRecursively(new File(path)); GraphDatabaseService ...

Read More »

Java 8: Sorting values in collections

java-logo

Having realised that Java 8 is due for its GA release within the next few weeks I thought it was about time I had a look at it and over the last week have been reading Venkat Subramaniam’s book. I’m up to chapter 3 which covers sorting a collection of people. The Person class is defined roughly like so:   ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close