Detailed Description
System Architecture
Figure 1. Block Diagram of MTA Trip Planner
Implementation
Creating Machine Learning Model
For each pair of connection stop and destination stop, create a machine learning model on AWS. The attributes are current timestamp, trip Id, day, and expected time. The target is the decision whether passenger should switch or not. Then, open the real-time prediction end point to allow lambda to access the model.
Python Server
The three inputs for the python server are starting stop, destination stop, and direction. The starting stop and destination stop will be any two stops on line 1, line 2, line 3. The direction is either uptown or downtown. Since a lot of factors should be considered for deriving optimal route, the problem is more sophisticated that we thought. Hence, to simplify the problem, if starting stop and destination stop are on the same line, then the output suggestion will be stay on that line. If the destination is in connection stop set and the starting stop is on line 1 only, then we will find the earliest switching stop that connects to line2 or line3. Then, we will use machine learning prediction to help users decide whether they should switch or not at the connection stop. If the starting stop is on line 2 or line3 and the destination stop is on line 1 only, then find the latest connection stop that connects to line 1 to switch. If the starting stop is on line 2 (line3) and destination stop is on line3 (line2), then output all the possible switching stops.
For the case that requires prediction from machine learning, we will first gather five recent valid feeds of local train by real time data streaming. Then, pick the feed with the time that is closest to current time, and then push the record to kinesis. Kinesis will invoke Lambda to run the Javascript that is saved on AWS. Then, Lambda will call the according machine learning model to make prediction. The prediction result will be send to Dynamodb and SNS. Then, the main program will retrieve the result from Dynamodb and display it to users. Users will also get a notification through text message in case of lost Internet connection in the subway.
For each pair of connection stop and destination stop, create a machine learning model on AWS. The attributes are current timestamp, trip Id, day, and expected time. The target is the decision whether passenger should switch or not. Then, open the real-time prediction end point to allow lambda to access the model.
Python Server
The three inputs for the python server are starting stop, destination stop, and direction. The starting stop and destination stop will be any two stops on line 1, line 2, line 3. The direction is either uptown or downtown. Since a lot of factors should be considered for deriving optimal route, the problem is more sophisticated that we thought. Hence, to simplify the problem, if starting stop and destination stop are on the same line, then the output suggestion will be stay on that line. If the destination is in connection stop set and the starting stop is on line 1 only, then we will find the earliest switching stop that connects to line2 or line3. Then, we will use machine learning prediction to help users decide whether they should switch or not at the connection stop. If the starting stop is on line 2 or line3 and the destination stop is on line 1 only, then find the latest connection stop that connects to line 1 to switch. If the starting stop is on line 2 (line3) and destination stop is on line3 (line2), then output all the possible switching stops.
For the case that requires prediction from machine learning, we will first gather five recent valid feeds of local train by real time data streaming. Then, pick the feed with the time that is closest to current time, and then push the record to kinesis. Kinesis will invoke Lambda to run the Javascript that is saved on AWS. Then, Lambda will call the according machine learning model to make prediction. The prediction result will be send to Dynamodb and SNS. Then, the main program will retrieve the result from Dynamodb and display it to users. Users will also get a notification through text message in case of lost Internet connection in the subway.
Frontend Get User Inputs On the home page, we provide user with three input text boxes namely: source, destination and direction, along with a submit button. The input boxes are data-list type so that the users can either type in whatever they want or just select whatever is in the list, and also, the system can autocomplete the input by matching the characters the user has typed. Send to the Backend Program After the user click the submit button, the system will send the source, destination, direction that the user chooses to the backend python program as the program's inputs. Then the program start execution. Get the Result After execution is done we get the output and render to the detail page. At the same time the system will jump to the new detail page and display the html content with the output to the users. The output consist of which line to take, available switch choice, switch decision and switch stop. |
Figure 3. Front End Control Flow Diagram
|