1
$\begingroup$

I was asked this during an interview that I did not crack.

You are given data of total (aggregated) power consumption, and the TV power consumption of three households. Each household has data for one day. Task 1: Using TV instantaneous power consumption data, identify the times when the TV is “ON”. Notice that some TVs may have standby modes. Task 2: Using all the data given, design a classifier to identify times when the TV is “ON”. You may also want to train and test your designed classifier. The trained classifier should not take TV instantaneous power as input. Please provide a script which attempts task 1 and 2. Please do not provide a script without explanations.

Additional information: Data format in the attached .csv file: “House” column indicates which house it is, ranging from 1 to 3. “Time” column indicates time stamps. “TV” column indicates TV instantaneous power consumption. “Agg” column indicates total (aggregated) instantaneous power consumption. Sampling rate is 1/60 Hz.

My submission is here.

I did not receive any feedback from the employer and I don't know what went wrong. Please let me know your thoughts on what could have been done better.

$\endgroup$
3
  • $\begingroup$ You may be looking for codereview $\endgroup$
    – N. Kiefer
    Commented Sep 3, 2020 at 11:48
  • $\begingroup$ Your data link is not public, shows "you need permission for this". You can upload datasets also to Kaggle $\endgroup$
    – Jon Nordby
    Commented Sep 5, 2020 at 10:19
  • $\begingroup$ @jonnor, added link to the dataset that I've now uploaded on Kaggle. $\endgroup$ Commented Sep 5, 2020 at 10:45

1 Answer 1

3
$\begingroup$

Some feedback/tips/tricks/opinions here:

Problem setup

Including requirement analysis. Gotta decide how the system/solution should work, how to know ho how well we are doing, and then how to get there.

Model evaluation.

It is very desirable to have a quantitative way to evaluate our model performance. For that we want some labeled data. It is very quick to count the number of ON events (given assumptions) for each house. House 1, 4 times. House 2, 3 times. House 3, 2 times. Then at least we can use that as an evaluation metric. Could also mark the times in the dataset to compute a percentage of ON time. That would be a more granular/precise metric to evaluate by. Strongest evaluation would be to check that each event time was also correct (within some tolerance).

Generalization

A model trained on N TVs/houses will also work on unseen houses. Very desirable, as allows the same model to be used for all houses, including future ones.

For this reason one should do possibly do Cross Validation grouped by house. Might also want to use Time-Series splitting, but a bit hard on such a tiny dataset.

System behaviour assumptions

We assume that that Power(ON) >> Power(Standby) > Power(Off).

However each TV might have different Power levels, as well as differences/ratios between the three levels. Different houses may also have different behavioral patterns in turning on/off.

Minimum on time.

It is reasonable to assume/set some minimum time for TV on/off. Can be informed from data, or set based on what you know about TVs. Maybe 10 seconds is OK?

Technique feedback

EDA

Really missing a histogram over power level!

Denoisning

KNearestNeighbours is too complex/opinionated for this. A running mean or running median would be more suitable.

Classifier

GradientBoostingClassifier wayy to complex. You have a single feature and tiny amounts of data.

GaussianMixtureModel is quite relevant, as this is a classic case of Hidden States and transitions. However it is still not clear if the complexity is justified - ie if the problem cannot be solved with just state-independent thresholding

Report feedback

Your notebook indicates heavy work-in-progress, it does not have the qualities of a report. Of course if you did this live, on-the-spot or with a very tight deadline, that is natural. But if you had several hours on this task, I would expect a much cleaner notebook.

  • The intro should define/re-state the problem(s). So that the report is self-container
  • An Exploratory Data Analysis section should be before models. Question -> Data Exploration -> Findings.
  • All non-interesting findings or explorations should be removed!
  • Low use of global variables, proper use of functions. Models should use pipelines where appropriate
  • Use pandas time series functionality. All time-series plots should have time on axis!
  • After the EDA and models, Results, and then a Discussion/Conclusion
  • You may want to also have the most important findings/conclusions summarized on top
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.