Package 'TrafficBDE'

Title: Traffic Predictions Using Neural Networks
Description: Estimate and return either the traffic speed or the car entries in the city of Thessaloniki using historical traffic data. It's used in transport pilot of the 'BigDataEurope' project. There are functions for processing these data, training a neural network, select the most appropriate model and predict the traffic speed or the car entries for a selected time date.
Authors: Kleanthis Koupidis [aut, cre], Aikaterini Chatzopoulou [aut], Charalampos Bratsas [aut], Panagiotis Tzenos [dtc], Josep Maria Salanova [dtc]
Maintainer: Kleanthis Koupidis <[email protected]>
License: GPL-2 | file LICENSE
Version: 0.1.1
Built: 2025-03-08 05:02:55 UTC
Source: https://github.com/okgreece/trafficbde

Help Index


Fill Missing Dates

Description

This function fills the missing dates from the data.

Usage

fillMissingDates(Data, datetime)

Arguments

Data

The historical data

datetime

The datetime wanted

Details

This function returns a data frame without missing dates.

Value

A data frame with all the historical data between the first date and the date wanted.

Author(s)

Aikaterini Chatzopoulou, Charalampos Bratsas

See Also

loadData, fillMissingValues

Examples

SpecLink <- loadDataSpecLink("163204843","1", X163204843_1)
x <- fillMissingValues(SpecLink)
datetime <- "2017-01-27 14:00:00" 
newData <- fillMissingDates (x, datetime)

Fill Missing Values

Description

This function fills the missing values from the data.

Usage

fillMissingValues(Data)

Arguments

Data

The historical data of the roads of Thessaloniki

Details

This function returns a data frame without missing values.

Value

A data frame with all the historical data without missing values

Author(s)

Aikaterini Chatzopoulou, Kleanthis Koupidis, Charalampos Bratsas

See Also

loadData

Examples

SpecLink <- loadDataSpecLink("163204843","1", X163204843_1)
x <- fillMissingValues(SpecLink)

k Steps Forward

Description

This function predictes the wanted value after k steps.

Usage

kStepsForward (Data, Link_id, direction, datetime, predict, steps)

Arguments

Data

A data frame with the historical data

Link_id

A character with the id of the road needed

direction

The direction of the road

datetime

The datetime wanted

predict

The value to be predicted

steps

The number of steps

Details

This function returns the predicted value after k steps.

Value

The predicted value

Author(s)

Aikaterini Chatzopoulou, Kleanthis Koupidis, Charalampos Bratsas

See Also

loadData

Examples

## Not run: 
kStepsForward (X163204843_1, "163204843", "1", "2017-01-27 14:00:00", "Mean_speed", 1)
## End(Not run)

Load traffic data

Description

This function loads the traffic data.

Usage

loadData(path)

Arguments

path

The path where the data are.

Details

This function returns a data frame with the traffic data of the roads of Thessaloniki ordered by the roads.

Value

Returns a data frame.

Author(s)

Aikaterini Chatzopoulou, Kleanthis Koupidis, Charalampos Bratsas


Load Train and Test Data

Description

This function returns a list with the train and test data.

Usage

loadTrainTest(Data, datetime, predict)

Arguments

Data

The historical data

datetime

The date time the user wants to predict

predict

The value he user wants to predict must be a column name of the data set

Details

This function returns a list with the train and test data that will be used for train and prediction.

Value

A list with the following components:

  • trainsData The trainData for the model

  • testsData The testData to be predict

Author(s)

Aikaterini Chatzopoulou, Kleanthis Koupidis, Charalampos Bratsas

Examples

SpecLink <- loadDataSpecLink("163204843","1", X163204843_1)
x <- fillMissingValues(SpecLink)
datetime <- "2017-01-27 14:00:00" 
newData <- fillMissingDates (x, datetime)
DataList <- loadTrainTest (newData, datetime, "Mean_speed")

Prediction

Description

This function predicts the average speed of the road.

Usage

PredictionCR(List,NNOut,predict)

Arguments

List

A list with the following components: trainset, testset, MinMaxFromScaling

NNOut

The train model

predict

The value to be predicted

Details

This function returns the predicted average speed.

Value

The predicted average speed of the road

Author(s)

Aikaterini Chatzopoulou, Kleanthis Koupidis, Charalampos Bratsas

See Also

PreProcessingLink, TrainCR

Examples

## Not run: 
SpecLink <- loadDataSpecLink("163204843","1", X163204843_1)
x <- fillMissingValues(SpecLink)
datetime <- "2017-01-27 14:00:00" 
newData <- fillMissingDates (x, datetime)
DataList <- loadTrainTest (newData, datetime, "Mean_speed")
List <- PreProcessingLink(DataList)
NNOut <- TrainCR (List,"Mean_speed")
predicted <- PredictionCR(List,NNOut,"Mean_speed")
## End(Not run)

Train

Description

This function trains the model.

Usage

TrainCR(List,predict)

Arguments

List

A list with the following components: trainset, testset, Min, Max

predict

The value to be predicted

Details

This function returns the trained model.

Value

The train model

Author(s)

Aikaterini Chatzopoulou, Kleanthis Koupidis

See Also

PreProcessingLink

Examples

## Not run: 
SpecLink <- loadDataSpecLink("163204843","1", X163204843_1)
x <- fillMissingValues(SpecLink)
datetime <- "2017-01-27 14:00:00" 
newData <- fillMissingDates (x, datetime)
DataList <- loadTrainTest (newData, datetime, "Mean_speed")
List <- PreProcessingLink(DataList)
NNout <- TrainCR (List,"Mean_speed")
## End(Not run)

Sample data from Traffic BDE

Description

Sample data of the traffic data of the road with Lik id "163204843" and direction = "1"

  • The Link id of the road

  • The direction of the road

  • The date and time of the recorded arguments

  • The min speed each time

  • The max speed each time

  • The mean speed each time

  • The standard deviation of the speed

  • The skewness of the speed

  • The kurtosis of the speed

  • The entries each time

  • The unique entries each time

Format

RData file

Source

TrafficBDE