#419Classify the sequence taskEasyRNN
Classify the sequence task
Background
Sequence problems are categorised by how many elements go in and come out:
| input length | output length | category |
|---|---|---|
| 1 | 1 | one-to-one |
| > 1 | 1 | many-to-one (e.g. sentiment) |
| 1 | > 1 | one-to-many (e.g. captioning) |
| > 1 | > 1 | many-to-many (e.g. translation) |
Problem statement
Implement task_category(input_len, output_len) returning the category string.
Input
input_len—int.output_len—int.
Output
Returns one of "one-to-one", "many-to-one", "one-to-many", "many-to-many".
Examples
Example 1 — sentiment classification
Input: input_len = 5, output_len = 1
Output: "many-to-one"
Example 2 — translation
Input: input_len = 5, output_len = 7
Output: "many-to-many"
Constraints
- "many" means length
> 1; "one" means length== 1. - Return the exact category string.
Notes
- The category tells you the architecture shape: where the network reads inputs and where it must emit outputs.
Python
Loading...
▶ Run executes the 3 visible sample tests below in your browser. Submit runs the full suite — including hidden tests — on the server for an official verdict.
- •Reference many to one
- •Sample one to many
- •Example many to many