In one of the companies I applied for a job, I got the following assignments.
Just posting for anyone who would like to have an idea of real world examples.
For the record I don't consider those hard and I believe I overdelivered but still got rejected.
The job title was Software Engineer - Data Science, although it was closer to Data engineering as you will see.
Assignment 1
Please describe your design of a service, described below, that distributes the budget for all newly created jobs each day and stores the results for other services. There is an existing function for distributing the total budget for a job to the various marketing platforms that this service needs to use:
distribute_budget(job_id, budget)
where job_id is the identifier for the job (an integer) and budget is the total budget to be allocated to the sources (a float). It returns a dictionary of the platform name and the amount allocated to that source. For example you might run
distribute_budget(123, 300.00)
and it could return:
{‘indeed’: 150, ‘facebook’: 70, ‘google’: 50, ‘linkedin’: 30}.
The output depends on the job_id and contains some randomness, so running distribute_budget(123, 300.00) and distribute_budget(456, 300.00) will produce different outputs and even running distribute_budget(123, 300.00) multiple times will produce slightly different outputs (you don’t have to concern yourself with how it differentiates between jobs, just that the output is specific to the job).
The backend database has a table of jobs (named “jobs”) with the columns:
job_id <integer>, created_at <timestamp>, days_to_stay_online_from_the_creation_date<integer>...
And a second table with the total budgets (named “budgets”), with the columns:
job_id <integer>, budget <float>
We need a service that distributes the budget for all newly created jobs each day and stores the results for other services, which don’t yet exist. Those other services will need the budget for each source for all jobs that are online, but they do not place any other requirements on this service. Assume there are currently ~10 new jobs at a time, and running distribute_budget(...) 10 times in a row is slow and just acceptable. However, in 6 months there are 100 new jobs at a time, and in 1.5 years there could be 1000 new jobs at a time. What would be your design for the service? Where would you build it?
There is no “correct” answer or “correct” assumptions. This task is about how you think, so list any assumptions you make and what design follows from that. Assume the current backend and frontend are in various AWS services, but this service can be anywhere and has no limitations except the following (a summary of the information above):
*It has to use information from the backend database, which is in AWS
*It has to store the output for at least the online lifetime of a job so that other services can use it
*It will use the existing distribute_budget(...) function, which takes the budget for one job and returns a dictionary of the amount allocated to each platform
Assignment 2
Write a program (not a Python notebook) that trains a linear regression for the training file, and predicts the number of applications for the entries in the test file. Use scikit-learn’s linear regression or some other existing function, instead of spending time creating your own. The output (job ID & prediction) should be written to a csv file. The purpose of this task is the program, not model accuracy, so don’t spend time trying to find the best model by hand.Concentrate on building a quality program that exemplifies your software engineering skills for training and testing the model. The task should not take up too much time, so feel free to not implement the perfect solution but add notes for what you would do for a real program The inputs are: the Job type (represented by an integer here, but it is a categorical variable), the salary per hour, the city, and the number of hours each week. The target is the number of applications.
How would you extend this to run every day (where some other tool collects up-to-date historical data and new jobs that need predictions each day)? Are there changes you would make if this program was going to be run with enough historical jobs and jobs requiring a prediction that it takes too long if the jobs are run sequentially on a single machine?
[edit: format. can'tgetusedtoit ]