快门飞 code challenge

avatar 91523
david.fang
2459
0
收到一个code challenge立刻分享起来。
[align="left"]One way to analyze acquisition strategy and estimate marketing cost is to calculate the Lifetime Value (“LTV”) of a customer. Simply speaking, LTV is the projected revenue that customer will generate during their lifetime.[/align][align="left"]A simple LTV can be calculated using the following equation: 52(a) x t. Where a is the average customer value per week (customer expenditures per visit (USD) x number of site visits per week) and t is the average customer lifespan. The average lifespan for Shutterfly is 10 years.[/align][float="left"][/float]Code Requirements[align="left"]Write a program that ingests event data and implements one analytic method, below. You are expected to write clean, well-documented and well-tested code. Be sure to think about performance - what the performance characteristic of the code is and how it could be improved in the future.[/align][align="left"]You may use one of the following OO languages: Java, Python, Scala.[/align][float="left"][/float]Ingest(e, D)[align="left"]Given event e, update data D[/align][float="left"][/float]TopXSimpleLTVCustomers(x, D)[align="left"]Return the top x customers with the highest Simple Lifetime Value from data D.[/align][align="left"]Please note that the timeframe for this calculation should come from D. That is, use the data that was ingested into D to calculate the LTV to frame the start and end dates of your LTV calculation. You should not be using external data (in particular "now") for this calculation.[/align][float="left"][/float]Events[align="left"]Please use the following sample events the Data Warehouse collects from Shutterfly’s public sites. All events have a key and event_time, but are received with no guaranteed order and with fluctuating frequency.[/align][align="left"]See sample_input directory for a sample of each event.[/align][float="left"][/float]Customer
  • type
    • CUSTOMER
  • verb
    • NEW
    • UPDATE
  • Additional Data
    • key(customer_id)
    • event_time
    • last_name
    • adr_city
    • adr_state

[float="left"][/float]Site Visit
  • type
    • SITE_VISIT
  • verb
    • NEW
  • Additional Data
    • key(page_id)
    • event_time
    • customer_id
    • tags (array of name/value properties)

[float="left"][/float]Image Upload
  • type
    • IMAGE
  • verb
    • UPLOAD
  • Additional Data
    • key(image_id)
    • event_time
    • customer_id
    • camera_make
    • camera_model

[float="left"][/float]Order
  • type
    • ORDER
  • verb
    • NEW
    • UPDATE
  • Additional Data
    • key(order_id)
    • event_time
    • customer_id
    • total_amount


[align="left"]* represents required data[/align][float="left"][/float]Directory structure[align="left"]This project has the following directories, and it is expected that your code will follow the same structure.[/align]- README.md- src (your source will live here)- input (input file you create as proof of functionality lives here)- output (output file with the result of TopXSimpleLTVCustomers(10, D). Include the calculated LTV.)- sample_input (one event of each type for visualization purposes)[float="left"][/float]Reference[align="left"]blog.kissmetrics.com[/align][float="left"][/float]
  • 2
0条回复