Coder Social home page Coder Social logo

jair-jr / driverbehavior Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 4.0 2.77 MB

Driver data collection Android app, R pre-processing source code, and Java code for an evaluation of several machine learning algorithms.

Java 53.91% Shell 0.08% R 46.01%
driver-behavior machine-learning

driverbehavior's Introduction

Driver Behavior machine learning evaluation

This repository contains the source-code for my masters dissertation. It contains code for data collection, preprocessing and machine learning algorithm evaluation in the driver behavior domain.

Projects description

  • The AndroidStudioProjects folder contains the Android app which collects sensor data;
  • The apm_R folder contains R code for sensor data preprocessing and graphics generation;
  • The apm folder contains Java code that performs an evaluation of several machine learning algorithms using Weka and LIBSVM;

Raw data set preprocessing

The first step to execute the evaluation is to use the R programming language (version 3.3.3 or above) to pre-process raw sensor data sets. Preprocessing functions are located in apm.R and apmExtracao.R files. Below is a basic example of preprocessing code for the data sets in the data directory:

# Load required libraries
library('caret')
library('foreign')
library('parallel')
library('plyr')
library('stringr')

# Load the code
source('apm.R')
source('apmExtracao.R')

# Load trip data. We have four trips.
trip16 <- carregarTodosDadosSmartphone("data/16")
trip17 <- carregarTodosDadosSmartphone("data/17")
trip20 <- carregarTodosDadosSmartphone("data/20")
trip21 <- carregarTodosDadosSmartphone("data/21")

# Pre-process the data sets.
processedDataSets <- gerarDatasetsProcessados(viagens = list(trip16, trip17, trip20, trip21), 
                                              tempoQuadroEmSegundos = 1, 
                                              numerosQuadrosNaJanela = c(4,5,6,7,8), 
                                              dir = 'data/processedDataSets', 
                                              percentualDivisaoTreinoTeste = NA)

The above code will generate an output directory named 'data/processedDataSets' which contains the processed data sets. There will be a data set file for each combination of (i) data set type (attribute vector or time series); (ii) sensor; and (iii) number of frames in the sliding window (4 to 8, in the example). The generated files are in ARFF (Weka) and CSV formats. Some examples of the generated files are st_acelerometro_nq7.arff, va_aceleracaoLinearTerra_nq8.csv, etc. The processedDataSets variable is a R list that holds the data sets as data frame objects.

Please, note that the entire process may take some time to complete. The following R libraries need to be installed and functional in your R environment: caret, foreign, parallel, plyr and stringr.

driverbehavior's People

Contributors

jair-jr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.