Skip to content

Commit

Permalink
Finished up the README file and deleted a comment in the model.py file
Browse files Browse the repository at this point in the history
  • Loading branch information
songcelia88 committed Dec 15, 2018
1 parent 795736f commit eb161d0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
36 changes: 25 additions & 11 deletions README.md
Expand Up @@ -19,6 +19,7 @@ and selecting whether you'd like a timed workout or to go at your own pace.

Click Start Workout.
![homepage](/static/img/readme-imgs/homepage.png)
<img src="/static/img/readme-imgs/homepage.png" width="200">

#### Controls
If you chose a Timed workout, you'll see a play button. If you click it, it will start the workout
Expand Down Expand Up @@ -122,24 +123,37 @@ generating a next pose until I hit the limit (which is specified by the duration


### Refining the Model
The workouts generated by the first version of this were very naive and not the most interesting of yoga sequences. There were 2 problems: 1) there were not enough relationships set up between poses, so the workouts generated would often
cycle back and forth between a few poses (which is not very interesting!) 2) the other was that if a user inputted a difficulty or emphasis, that ended up narrowing the pool of poses even more, e.g. if a user selected an Expert difficulty
it would only take from expert level poses and not from any beginner or intermediate poses at all. Which doesn't make a lot of sense since an ideal expert level workout would include some beginner and intermediate poses with an emphasis on expert level poses.
The workouts generated by the first version of this were very naive and not the most interesting of yoga sequences. There were 2 problems:
1) there were not enough relationships set up between poses, so the workouts generated would often
cycle back and forth between a few poses (which is not very interesting!)
2) the other was that if a user inputted a difficulty or emphasis, that ended up narrowing the pool of poses even more, e.g. if a user selected an Expert difficulty it would only take from expert level poses and not from any beginner or intermediate poses at all. Which doesn't make a lot of sense since an ideal expert level workout would include some beginner and intermediate poses with an emphasis on expert level poses.

To solve the first problem, I used known yoga sequences (such as Sun Salutation A, Sun Salutation B, etc.) to refine and update the weights. Basically, I went through each of those known yoga sequences, took the current pose, found it in my database, checked the next pose in the sequence and checked to see if my current pose had this next pose listed in its attribute. If not, I added that next pose. If it was in there, I increased the weight for the pose. This improved the workouts generated by a little bit but more importantly in doing this, I set up the system so it could improve with time.
![saved workouts 2](/static/img/readme-imgs/saved-workouts-2.png)


Saving workouts - update weights for each pose with each saved workout
still had to manually go in and massage the data a bit more to establish relationships between poses
When the user saves a workout, I assume that it means they like the workout enough that the sequence of poses are good and make sense. So we update the weights of the poses in the saved workout accordingly when the user saves the workout. This means that as more users save workouts the model will improve and sort of normalize the workouts it creates.

For the second problem,
(have to filter out the appropriate poses to choose from first)
also had to update the library of poses to choose from
Even with these adjustments, I still had to massage the data a bit more to establish relationships between poses and create relationships for poses that previously had no ties to other poses. Unfortunately, I couldn't really think of an automated way of doing it, so I had to spend a bit of time manually entering in all the relationships between poses.

For the second problem, to expand the pool of poses to choose from when a user selects a difficulty and/or emphasis, I did it in steps. I first took all the poses that exactly meet the user's requirements, e.g. if it was intermediate level and the emphasis was on abs/core, I took all the poses that exactly met that criteria. This was ranked first.

I then created a second set of alternate poses to choose from that met the criteria but were of lower difficulty. So for the above example, I took all the poses that were of beginner level and emphasis was on abs/core. This is ranked second.

Finally I created a set of 30 basic poses that can be included in any level workout. These poses are just standard poses that are common in every yoga workout (such as downward dog, mountain, etc.) This is ranked last.

With this new expanded pool of poses to choose from, when a next pose is chosen I check to make sure that the pose is either in the 1st set, 2nd set or third set.

All these changes combined seemed to improve the workouts generated. At this point, I was mostly looking for a variety of poses in the workout for a more interesting/varied workout and making sure that a workout didn't just cycle back and forth between a few poses. There's still lots to be done though!


## Future Things aka Stuff I want to Add
- More Testing! (I only have a few tests written so far)
- Mobile optimized layout
- Restart/looping through a workout
- User Accounts/Login (Google Login)
- also have an Admin mode so that only certain people make changes
- Voice narration

## Future Things
add testing, mobile optimized format, restart/looping through a workout, voice narration
add user accounts and admin mode


4 changes: 0 additions & 4 deletions model.py
Expand Up @@ -206,10 +206,6 @@ def generateWorkout(num_poses, difficulty=DIFFICULTIES, categories=None):

default_poses = [Pose.query.get(pose_id) for pose_id in default_pose_ids]
default_poses_set = set(default_poses)
# for pose in default_poses: # this adds the default poses to the overall poses set to choose from
# if pose not in all_poses_set:
# all_poses_set.add(pose)


# start with a pose
start_pose = random.choice(all_poses)
Expand Down

0 comments on commit eb161d0

Please sign in to comment.