aws / aws/amazon-sagemaker-examples
[Content Improvement] An Introduction to SageMaker Random Cut Forests Shringe Function Improvements
- Dominant language
- Jupyter Notebook
- Stars
- 11k
- Forks
- 7k
- Avg merge
- 8h 29m
- Merged PRs (30d)
- 8
Description
**Link to the notebook**
[An Introduction to SageMaker Random Cut Forests](https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/random_cut_forest/random_cut_forest.ipynb)
**What aspects of the notebook can be improved?**
- Current `shingle(data, shingle_size` functions miss out last row of the dataframe given. Look at the image below for more details.


**What are your suggestions?**
- change `num_data - shingle_size` statement to `num_data - shingle_size + 1` statement.
(last row need to be seen)
**AS-IS**
```
def shingle(data, shingle_size):
num_data = len(data)
shingled_data = np.zeros((num_data - shingle_size, shingle_size))
for n in range(num_data - shingle_size):
shingled_data[n] = data[n : (n + shingle_size)]
return shingled_data
```
---
**TO-BE**
```
def shingle(data, shingle_size):
num_data = len(data)
shingled_data = np.zeros((num_data - shingle_size + 1, shingle_size))
for n in range(num_data - shingle_size + 1):
shingled_data[n] = data[n : (n + shingle_size)]
return shingled_data
```
Contributor guide
Research direction
Open introduction_to_amazon_algorithms/random_cut_forest/random_cut_forest.ipynb and find the shingle(data, shingle_size) function. Check the current row-count calculation and loop range against the examples in the issue; it is done when the final valid shingle, including the last dataframe row, is included.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook, numpy, python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100