Commit Graph

34 Commits

Author SHA1 Message Date
Gary Engler 7a9d1fa4eb Database Table Creation Modification
Summary:
Modified:
fbcode/fbjava/fb-spark-applications/rl/dqn-preprocessing/src/main/scala/com/facebook/spark/rl/MultiStepTimeline.scala

To have a similar table creation process as:
fbcode/fbjava/fb-spark-applications/rl/dqn-preprocessing/src/main/scala/com/facebook/spark/rl/Timeline.scala

Reviewed By: czxttkl

Differential Revision: D19662523

fbshipit-source-id: 9cfd789d4a0d737ca0d0a54019be332104699717
2020-02-10 14:49:00 -08:00
Zhengxing Chen 0d32fad4ca Format scala code
Summary: Format scala code

Reviewed By: kittipatv

Differential Revision: D19542670

fbshipit-source-id: c0e604a3acaece0359a2a28d4c0c52dea536bff2
2020-02-10 14:49:00 -08:00
Zhengxing Chen 9a75e3dcfd Support customized reward types in Spark Timeline Operator
Summary: As titled

Reviewed By: kittipatv

Differential Revision: D19356811

fbshipit-source-id: 820315a0808401b20eeaf26ed012b5bc93ff6fde
2020-02-10 14:48:59 -08:00
Zhengxing Chen fed370d1b9 Fix usage example (#196)
Summary:
Fix the usage example such that it obtains a reasonable policy.

Pull Request resolved: https://github.com/facebookresearch/ReAgent/pull/196

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

Existing tests pass.
Manually ran `run_end_to_end_test.sh` and it passed.

Reviewed By: kittipatv

Differential Revision: D19078228

Pulled By: czxttkl

fbshipit-source-id: d50f4fd258583635d16b087f324cd75d18931200
2019-12-29 05:14:49 -08:00
Kittipat Virochsiri dd88c94670 Fixing NullPointerException
Summary: The previous diff missed the other usage

Reviewed By: czxttkl

Differential Revision: D15451561

fbshipit-source-id: d69c233d1a8e75a10dc06165e845d2463ca9bde6
2019-05-22 13:19:01 -07:00
Kittipat Virochsiri 7d2669a5d2 fix oss spark operator
Summary: The object mapping library (jackson) doesn't give default value when the key is missing from json.

Reviewed By: econti

Differential Revision: D15447137

fbshipit-source-id: f25b818b1f03941f7f393b694a92f0b6025845c3
2019-05-21 23:01:40 -07:00
Kittipat Virochsiri 2f0617c4ca Simplify additional feature columns
Summary: Add `extraFeatureColumns` as an option to make it easier to add new columns for different feature types. User would just have to write out what additional columns they want to include in the timeline operator.

Reviewed By: czxttkl

Differential Revision: D15429253

fbshipit-source-id: e2311042d951b4236b37eb52161f39b182e294cc
2019-05-21 09:37:53 -07:00
Kittipat Virochsiri ae54764f9b Handle sparse action in Timeline operator
Summary: I need this mainly so that we can test making policy output ranking directly.

Reviewed By: czxttkl

Differential Revision: D15342509

fbshipit-source-id: 85c20b6e272292d3a0c1840ee1e9e855e9acbc70
2019-05-20 18:09:43 -07:00
Zhengxing Chen 5dd6536bfc Fix timeline mdp length filter
Summary: Episode length at x percentile could be either Long or Double, depending on the percentileFunction being used. When the percentileFunction is `fb_approx_percentile`, `val pct_val = res.getAs[Double]("pct")​` would cause `java.lang.Long cannot be cast to java.lang.Double` error because `fb_approx_percentile` returns a Long but not a Double. See https://our.intern.facebook.com/intern/chronos/jobinstance?jobinstanceid=8680643934&smc=chronos_atn_admin_client&offset=0 for a failed job example.

Reviewed By: kittipatv

Differential Revision: D15236953

fbshipit-source-id: 643e5063f07ac12c8017089b5a672235aa9a1db5
2019-05-07 12:51:53 -07:00
Kittipat Virochsiri 05354928d7 Add time_since_first column
Summary: Add time_since_first & add option to limit mdp length by time-since-first

Reviewed By: econti

Differential Revision: D14679646

fbshipit-source-id: afd70fe7c3630263aeaaa064cf9c4aecf9942655
2019-04-01 18:46:56 -07:00
Zhengxing Chen 537354663f Support adding sparse data in spark pipeline
Summary: Support adding sparse data in spark pipeline

Reviewed By: kittipatv, econti

Differential Revision: D14574901

fbshipit-source-id: 4086940a0082b199a724a6d44c048639bcc45a65
2019-03-23 00:32:25 -07:00
Zhengxing Chen 872cb70291 Update spark package to support multistep timeline operator in FBlearner
Summary: Following D13704487, this diff prevents spark timeline operator from returning NULL value, which could cause problems in fblearner flow.

Reviewed By: kittipatv

Differential Revision: D14453081

fbshipit-source-id: 5a6fe6abc52a7980619dbb848625135568d01843
2019-03-15 11:29:52 -07:00
Jason Gauci a42f1dc6a2 More oss fixes
Summary: Pull Request resolved: https://github.com/facebookresearch/Horizon/pull/104

Reviewed By: econti

Differential Revision: D14260743

Pulled By: MisterTea

fbshipit-source-id: 3ce1031e5da47a44aa7e6ab98fb5239312a769aa
2019-03-01 19:53:12 -08:00
Jason Gauci f5603b806a Fix OSS spark pipeline and add pipeline tests to jenkins. (#103)
Summary:
Fixes #101
Pull Request resolved: https://github.com/facebookresearch/Horizon/pull/103

Reviewed By: econti

Differential Revision: D14256680

Pulled By: MisterTea

fbshipit-source-id: 5bbacdeaf2ad7261a234c5f7dfed7da859ae5bcf
2019-02-27 23:50:10 -08:00
Kittipat Virochsiri d2b3779a87 Fix TimelineTest in OSS (#97)
Summary:
Pull Request resolved: https://github.com/facebookresearch/Horizon/pull/97

Newer version of Spark has `aprrox_percentile`, which is functionally equivalent to `fb_approx_percentile`.

Reviewed By: czxttkl

Differential Revision: D14163262

fbshipit-source-id: 11a3e9650c0ecb971b4db82cd4c946a20e8335a5
2019-02-20 23:31:07 -08:00
Kittipat Virochsiri c313b8b4f9 Save episode length as temp view
Summary: Caching the computation to improve speed

Reviewed By: czxttkl

Differential Revision: D14018487

fbshipit-source-id: a9d8590884169c95ec78aa7c417aaf18aeb6f835
2019-02-09 17:21:54 -08:00
Kittipat Virochsiri 6700c365e7 Change outlierEpisodeLengthPercentile to Option[Double]
Summary: JSON deserialization doesn't respect the type annotation :(

Reviewed By: MisterTea

Differential Revision: D14012830

fbshipit-source-id: c4a2c172768082c9ff8cd0ef68fd5a6f005dcca5
2019-02-08 17:14:11 -08:00
Kittipat Virochsiri 2303f1a0ea Add option to drop outlier episodes
Summary: `outlierEpisodeLengthPercentile` can be set to filter episode longer than the given value. If the filtering the outliers results in dropping more episodes than expected, the filtering won't be applied.

Reviewed By: czxttkl

Differential Revision: D13999112

fbshipit-source-id: 6a2cd5ba674838e6d72f4d1d6c81775ce9ec217b
2019-02-08 00:00:48 -08:00
Jason Gauci c9c7cd6631 Move RLTimeline operator into fblearner flow
Summary: Move RLTimeline operator into fblearner flow.  Move non-workflow code into fblearner/flow/projects/rl/core/...

Reviewed By: kittipatv, econti

Differential Revision: D13815544

fbshipit-source-id: 98b185ad0687ce497a7d61e73eaa2155cfd8ecf3
2019-02-04 19:41:10 -08:00
Jason Gauci 30c75bed0e Update installation & usage guide, and fix issues related to that.
Summary: Pull Request resolved: https://github.com/facebookresearch/Horizon/pull/93

Reviewed By: kittipatv, econti

Differential Revision: D13873903

Pulled By: MisterTea

fbshipit-source-id: bb75dd687f6de0e3884c841e4bdfc460c44662d3
2019-01-30 12:00:19 -08:00
Edoardo Conti bb90fd3f2e Don't return NULL values from Timeline
Summary: Returning NULL values breaks hive reader in our fblearner flows. However, empty values are required if adding terminal states to training data. This diff changes the columns values for terminal states from NULL to the corresponding empty data structure ({}, [], "", etc).

Reviewed By: MisterTea

Differential Revision: D13704487

fbshipit-source-id: 8398cb272e756f413f379f2459165a583546e8c8
2019-01-16 17:20:21 -08:00
Zhengxing Chen 30805dee3f Add a spark pipeline for Multi-Step RL
Summary:
Write a new spark pipeline for supporting multi-step RL.
The test in dataswarm is in D13125518

Reviewed By: kittipatv

Differential Revision: D13049646

fbshipit-source-id: e388ca415de6c227c46439474fec5de7f6ff8220
2018-12-15 10:37:09 -08:00
Jason Gauci 01be9c164a Refactor Evaluator
Summary:
The evaluator has become difficult to work with.  This diff does the following:

1. Creates an EvaluationDataPage similar to TrainingDataPage.
2. Separates datasets into training and evaluation.  Evaluation datasets are stored in order so we do not need to un-shuffle them.
3. Assumes the evaluator can process all of the data in one shot.  This assumption is now true because we don't need to store features in EvaluationDataPage and we don't need to evaluate during training.
4. Split evaluator.py into: evaluator.py, cpe.py, *_estimator.py

The diff creates some TODOs that I'll turn into tasks (likely bootcamp tasks):

1. Write tests for the estimators

Reviewed By: econti

Differential Revision: D13279810

fbshipit-source-id: fb11ac35ccfb785051f272abfcb9a549fa8fbe64
2018-12-14 11:06:28 -08:00
Jason Gauci e3abf433f8 Remove reward_timeline
Summary: Remove reward timeline since we compute MC loss at end of epoch.

Reviewed By: kittipatv

Differential Revision: D10528238

fbshipit-source-id: 67c17a50df65ef9a37945e8f578bb884ed83df22
2018-10-25 19:51:11 -07:00
Edoardo Conti f33f3d0cce Get end-to-end training working
Summary: title

Reviewed By: MisterTea

Differential Revision: D10440251

fbshipit-source-id: 5bb237b695dad63e2ad820273e65ac65cbd19533
2018-10-18 13:43:44 -07:00
Jason Gauci 358232bd8f Update oss info
Summary: Pull Request resolved: https://github.com/facebookresearch/Horizon/pull/42

Reviewed By: kittipatv

Differential Revision: D10440812

Pulled By: MisterTea

fbshipit-source-id: bb1f5960f67d6bb9c96dd118810cdb4a57666750
2018-10-17 19:31:53 -07:00
Jason Gauci 56e7fab44f Spark changes: Write timeline in .parquet, Change feature IDs to ints. Add metrics column. (#41)
Summary:
[WIP] Spark changes: Write timeline in .parquet, Change feature IDs to ints.  Add metrics column.
Pull Request resolved: https://github.com/facebookresearch/Horizon/pull/41

Reviewed By: kittipatv

Differential Revision: D10419376

Pulled By: MisterTea

fbshipit-source-id: 8062872304fcecaa1b6f105edf706265a8f3651e
2018-10-17 15:59:04 -07:00
Edoardo Conti c1a592fd03 Take number of shards as argument and update readme
Summary: title

Reviewed By: kittipatv

Differential Revision: D10410363

fbshipit-source-id: 1046a290ccc7c453e8d96d4c54d633537e144b8a
2018-10-16 14:42:59 -07:00
Jason Gauci db7465d92c Minor tweaks to scripts
Summary: Pull Request resolved: https://github.com/facebookresearch/Horizon/pull/38

Reviewed By: kittipatv

Differential Revision: D10403632

Pulled By: MisterTea

fbshipit-source-id: 0be0bfe01b18c261025f6ef6f4c529fe2c2e006d
2018-10-16 10:45:18 -07:00
Edoardo Conti 469801c31f Add parametric DQN & DDPG query to scala timeline
Reviewed By: MisterTea

Differential Revision: D9838545

fbshipit-source-id: 77de84640e9cc8355bfe49de01640570f3c8b8c5
2018-09-16 21:35:03 -07:00
Edoardo Conti 76af08477a Add DQN query to Scala Timeline Operator
Summary: title

Reviewed By: MisterTea

Differential Revision: D9825168

fbshipit-source-id: 5330e62a35df85811fdcafc3e004c2ae1e0ad6d8
2018-09-14 11:49:24 -07:00
Edoardo Conti c5b6737e4b Allow gym to generate parametric data + fix to parametric timeline
Summary: (Note: this ignores all push blocking failures!)

Reviewed By: MisterTea

Differential Revision: D9761893

fbshipit-source-id: 6212b15a1ac8b953e5a21709d6643bac595d6687
2018-09-11 06:32:13 -07:00
Jason Gauci b33d7a6874 oss-pom -> pom 2018-09-10 14:29:13 -07:00
Jason Gauci e2381517e2 Add preprocessing logic 2018-09-07 11:17:36 -07:00