This page includes more visual versions of the information on the grading page. You should read both, but this one is often more helpful, because some of the processes take a lot of words to explain and make more sense with a diagram for a lot of people.
Source
%matplotlib inline
import os
from datetime import date,timedelta
import calendar
import pandas as pd
import numpy as np
import seaborn as sns
# style note: when I wrote this code, it was not all one cell. I merged the cells
# for display on the course website, since Python is not the main outcome of this course
# import constants from cspt
from cspt import CourseDates
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
course_dates = CourseDates()
meetings = course_dates.class_meeting_strings
# build a table for the dates
badge_types = ['experience', 'review', 'practice']
target_cols = ['review_target','practice_target']
df_cols = badge_types + target_cols
badge_target_df = pd.DataFrame(index=meetings, data=[['future']*len(df_cols)]*len(meetings),
columns=df_cols).reset_index().rename(
columns={'index': 'date'})
# set relative dates
today = date.today()
start_deadline = date.today() - timedelta(7)
complete_deadline = date.today() - timedelta(14)
# created indexing bools with casting types first, then reuse them throughout below
before_today = pd.to_datetime(badge_target_df['date']) <=pd.to_datetime(today)
before_start = pd.to_datetime(badge_target_df['date']) <=pd.to_datetime(start_deadline)
before_complete = pd.to_datetime(badge_target_df['date']) <=pd.to_datetime(complete_deadline)
before_penalty = pd.to_datetime(badge_target_df['date']) <=pd.to_datetime(course_dates.penalty_free_end)
# mark eligible experience badges
# mark targets, cascading from most recent to oldest to not have to check < and >
badge_target_df['experience'][before_today] = 'eligible'
badge_target_df['review_target'][before_today] = 'active'
badge_target_df['practice_target'][before_today] = 'active'
badge_target_df['review_target'][before_start] = 'started'
badge_target_df['practice_target'][before_start] = 'started'
badge_target_df['review_target'][before_complete] = 'completed'
badge_target_df['practice_target'][before_complete] = 'completed'
# mark enforced deadlines
badge_target_df['review'][before_today] = 'active'
badge_target_df['practice'][before_today] = 'active'
badge_target_df['review'][before_start] = 'started'
badge_target_df['practice'][before_start] = 'started'
badge_target_df['review'][before_complete] = 'completed'
badge_target_df['practice'][before_complete] = 'completed'
badge_target_df['review'][before_penalty] = 'penalty free'
badge_target_df['practice'][before_penalty] = 'penalty free'
# convert to numbers and set dates as index for heatmap compatibility
status_numbers_hm = {status:i+1 for i,status in enumerate(['future','eligible','active','penalty free','started','completed'])}
badge_target_df_hm = badge_target_df.replace(status_numbers_hm).set_index('date')
# set column names to shorter ones to fit better
badge_target_df_hm = badge_target_df_hm.rename(columns={'review':'review(e)','practice':'practice(e)',
'review_target':'review(t)','practice_target':'practice(t)',})
# build a custom color bar
n_statuses = len(status_numbers_hm.keys())
manual_palette = [sns.color_palette("pastel", 10)[7],
sns.color_palette("colorblind", 10)[2],
sns.color_palette("muted", 10)[2],
sns.color_palette("colorblind", 10)[9],
sns.color_palette("colorblind", 10)[8],
sns.color_palette("colorblind", 10)[3]]
# generate the figure, with the colorbar and spacing
ax = sns.heatmap(badge_target_df_hm,cmap=manual_palette,linewidths=1)
# mote titles from bottom tot op
ax.xaxis.tick_top()
# pull the colorbar object for handling
colorbar = ax.collections[0].colorbar
# fix the location fo the labels on the colorbar
r = colorbar.vmax - colorbar.vmin
colorbar.set_ticks([colorbar.vmin + r / n_statuses * (0.5 + i) for i in range(n_statuses)])
colorbar.set_ticklabels(list(status_numbers_hm.keys()))
# add a title
today_string = today.isoformat()
ax.set_title('Badge Status as of '+ today_string);/tmp/ipykernel_2790/3246643610.py:38: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['experience'][before_today] = 'eligible'
/tmp/ipykernel_2790/3246643610.py:39: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['review_target'][before_today] = 'active'
/tmp/ipykernel_2790/3246643610.py:40: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['practice_target'][before_today] = 'active'
/tmp/ipykernel_2790/3246643610.py:41: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['review_target'][before_start] = 'started'
/tmp/ipykernel_2790/3246643610.py:42: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['practice_target'][before_start] = 'started'
/tmp/ipykernel_2790/3246643610.py:43: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['review_target'][before_complete] = 'completed'
/tmp/ipykernel_2790/3246643610.py:44: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['practice_target'][before_complete] = 'completed'
/tmp/ipykernel_2790/3246643610.py:46: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['review'][before_today] = 'active'
/tmp/ipykernel_2790/3246643610.py:47: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['practice'][before_today] = 'active'
/tmp/ipykernel_2790/3246643610.py:48: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['review'][before_start] = 'started'
/tmp/ipykernel_2790/3246643610.py:49: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['practice'][before_start] = 'started'
/tmp/ipykernel_2790/3246643610.py:50: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['review'][before_complete] = 'completed'
/tmp/ipykernel_2790/3246643610.py:51: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['practice'][before_complete] = 'completed'
/tmp/ipykernel_2790/3246643610.py:52: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['review'][before_penalty] = 'penalty free'
/tmp/ipykernel_2790/3246643610.py:53: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment.
Such chained assignment never works to update the original DataFrame or Series, because the intermediate object on which we are setting values always behaves as a copy (due to Copy-on-Write).
Try using '.loc[row_indexer, col_indexer] = value' instead, to perform the assignment in a single step.
See the documentation for a more detailed explanation: https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#chained-assignment
badge_target_df['practice'][before_penalty] = 'penalty free'
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[1], line 71
67 sns.color_palette("colorblind", 10)[9],
68 sns.color_palette("colorblind", 10)[8],
69 sns.color_palette("colorblind", 10)[3]]
70 # generate the figure, with the colorbar and spacing
---> 71 ax = sns.heatmap(badge_target_df_hm,cmap=manual_palette,linewidths=1)
72 # mote titles from bottom tot op
73 ax.xaxis.tick_top()
74 # pull the colorbar object for handling
File ~/.local/lib/python3.12/site-packages/seaborn/matrix.py:459, in heatmap(data, vmin, vmax, cmap, center, robust, annot, fmt, annot_kws, linewidths, linecolor, cbar, cbar_kws, cbar_ax, square, xticklabels, yticklabels, mask, ax, **kwargs)
457 if square:
458 ax.set_aspect("equal")
--> 459 plotter.plot(ax, cbar_ax, kwargs)
460 return ax
File ~/.local/lib/python3.12/site-packages/seaborn/matrix.py:306, in _HeatMapper.plot(self, ax, cax, kws)
303 kws.setdefault("vmax", self.vmax)
305 # Draw the heatmap
--> 306 mesh = ax.pcolormesh(self.plot_data, cmap=self.cmap, **kws)
308 # Set the axis limits
309 ax.set(xlim=(0, self.data.shape[1]), ylim=(0, self.data.shape[0]))
File ~/.local/lib/python3.12/site-packages/matplotlib/__init__.py:1524, in _preprocess_data.<locals>.inner(ax, data, *args, **kwargs)
1521 @functools.wraps(func)
1522 def inner(ax, *args, data=None, **kwargs):
1523 if data is None:
-> 1524 return func(
1525 ax,
1526 *map(cbook.sanitize_sequence, args),
1527 **{k: cbook.sanitize_sequence(v) for k, v in kwargs.items()})
1529 bound = new_sig.bind(ax, *args, **kwargs)
1530 auto_label = (bound.arguments.get(label_namer)
1531 or bound.kwargs.get(label_namer))
File ~/.local/lib/python3.12/site-packages/matplotlib/axes/_axes.py:6534, in Axes.pcolormesh(self, alpha, norm, cmap, vmin, vmax, colorizer, shading, antialiased, *args, **kwargs)
6530 coords = np.stack([X, Y], axis=-1)
6532 kwargs.setdefault('snap', mpl.rcParams['pcolormesh.snap'])
-> 6534 collection = mcoll.QuadMesh(
6535 coords, antialiased=antialiased, shading=shading,
6536 array=C, cmap=cmap, norm=norm, colorizer=colorizer, alpha=alpha, **kwargs)
6537 collection._check_exclusionary_keywords(colorizer, vmin=vmin, vmax=vmax)
6538 collection._scale_norm(norm, vmin, vmax)
File ~/.local/lib/python3.12/site-packages/matplotlib/collections.py:2390, in QuadMesh.__init__(self, coordinates, antialiased, shading, **kwargs)
2388 kwargs.setdefault("pickradius", 0)
2389 super().__init__(coordinates=coordinates, shading=shading)
-> 2390 Collection.__init__(self, **kwargs)
2392 self._antialiased = antialiased
2393 self._bbox = transforms.Bbox.unit()
File ~/.local/lib/python3.12/site-packages/matplotlib/collections.py:209, in Collection.__init__(self, edgecolors, facecolors, linewidths, linestyles, capstyle, joinstyle, antialiaseds, offsets, offset_transform, norm, cmap, colorizer, pickradius, hatch, urls, zorder, **kwargs)
206 self._offset_transform = offset_transform
208 self._path_effects = None
--> 209 self._internal_update(kwargs)
210 self._paths = None
File ~/.local/lib/python3.12/site-packages/matplotlib/artist.py:1233, in Artist._internal_update(self, kwargs)
1226 def _internal_update(self, kwargs):
1227 """
1228 Update artist properties without prenormalizing them, but generating
1229 errors as if calling `set`.
1230
1231 The lack of prenormalization is to maintain backcompatibility.
1232 """
-> 1233 return self._update_props(
1234 kwargs, "{cls.__name__}.set() got an unexpected keyword argument "
1235 "{prop_name!r}")
File ~/.local/lib/python3.12/site-packages/matplotlib/artist.py:1209, in Artist._update_props(self, props, errfmt)
1205 if not callable(func):
1206 raise AttributeError(
1207 errfmt.format(cls=type(self), prop_name=k),
1208 name=k)
-> 1209 ret.append(func(v))
1210 if ret:
1211 self.pchanged()
File ~/.local/lib/python3.12/site-packages/matplotlib/collections.py:2264, in _MeshData.set_array(self, A)
2259 if shape not in ok_shapes:
2260 raise ValueError(
2261 f"For X ({width}) and Y ({height}) with {self._shading} "
2262 f"shading, A should have shape "
2263 f"{' or '.join(map(str, ok_shapes))}, not {A.shape}")
-> 2264 return super().set_array(A)
File ~/.local/lib/python3.12/site-packages/matplotlib/colorizer.py:568, in _ScalarMappable.set_array(self, A)
566 A = cbook.safe_masked_invalid(A, copy=True)
567 if not np.can_cast(A.dtype, float, "same_kind"):
--> 568 raise TypeError(f"Image data of dtype {A.dtype} cannot be "
569 "converted to float")
571 self._A = A
572 if not self.norm.scaled():
TypeError: Image data of dtype object cannot be converted to float
Getting Feedback¶
Who should you request/assign?
course item type | issue asignee | PR reviewer |
prepare work | assignment not required; can be student | none requierd; merge to experience branch |
experience badge | N/A | TA asigned to your group (will be automatic after a few classes) |
practice badge | assignment not required; can be student |
|
review badge | assignment not required; can be student |
|
explore badge | proposal, assigned to |
|
build badge | proposal, assigned to |
|
anything merged pre-emptively in penalty free | N/A |
|
Deadlines¶
We do not have a final exam, but URI assigns an exam time for every class. The date of that assigned exam will be the final due date for all work including all revisions.
experience, review, and practice badges have general deadlines. Explore and build deadlines are based on when you propose and you can propose your own.
Experience badges¶
Prepare work tasks must be done before class so that you are prepared. Missing a prepare task could require you to do an experience report to make up what you were not able to do in class.
If you miss class, the experience report should be at least attempted/drafted (though you may not get feedback/confirmation) before the next class that you attend. This is strict, not as punishment, but to ensure that you are able to participate in the next class that you attend. Skipping the experience report for a missed class, may result in needing to do an experience report for the next class you attend to make up what you were not able to complete due to the missing class activities.
If you miss multiple classes, create a catch-up plan to get back on track by contacting instructor either with an issue or email.
Review and Practice Badges¶
These badges have 5 stages:
posted: tasks are on the course website(review and practice) and an issue is created
started: one task is attempted and a draft PR is open
completed: all tasks are attempted PR is ready for review, and a review is requested
earned: PR is approved (by instructor or a TA) and work is merged
These badges badges must be started within one week of when they are posted and completed within two weeks. A task is attempted when you have answered the questions or submitted evidence of doing an activity or asked a sincere clarifying question.
If a badge is planned, but not started within one week it will become expired and ineligble to be earned. You may request extensions to complete a badge by updating the PR message, these will typically be granted. Extensions for starting badges will only be granted in exceptional circumstances.
Expired badges will receive a comment and be closed
Once you have a good-faith attempt at a complete badge, you have until the end of the semester to finish the revisions in order to earn the badge.
Explore Badges¶
Explore badges are feedback-limited. You will not get feedback on subsequent explore badge proposals until you earn the first one.
Explore badges have 5 stages:
proposed: issue created
in progress: issue is labeled “proceed” by the instructor
complete: work is complete, PR created, review requested
revision: “request changes” review was given
earned: PR approved
Once you have one earned, then you can have up to two in progress and two in revision at any given time. At most, you will receive feedback for one explore badge per week, so in order to earn six, your first one must start your first one early enough.
Build Badges¶
At most one build badge will be evaluated every 4 weeks. This means that if you want to earn 3 build badges, the first one must be in 8 weeks before the end of the semester.
Procedures¶
Prepare work and Experience Badges Process¶
This is for a single example with specific dates, but it is similar for all future dates
The columns (and purple boxes) correspond to branches in your KWL repo and the yellow boxes are the things that you have to do. The “critical” box is what you have to wait for us on. The arrows represent PRs (or a local merge for the first one)
In the end the commit sequence for this will look like the following:
You can merge the prepare into the experience with a PR or on the command line, your choice.
Where the “approved” tag represents and approving reivew on the PR.
You can, once you know how, do this offline and do the merge with in the CLI instead of with a PR.
Review and Practice Badge¶
Legend:
the diagrams do not look great in dark mode, use light mode for them
This is the general process for review and practice badges
Explore Badges¶
Build Badges¶
Community Badges¶
You can log them either manually or with help of an action that a past student contributed! It always ends up with a PR that must be reviewed by @brownsarahm
Logger Action¶
Your KWL repo has an action called “Community & Explore Badge Logger” that will help you.
Find that on the left hand list on the Actions tab of your repository.
You, too could contribute code that helps automate things in class or organize things
Manual logging¶
These are the instructions from your community_contributions.md file in your KWL repo:
For each one:
In the `community_contributions.md`` file on your kwl repo, add an item in a bulleted list (start the line with - )
Include a link to your contribution like
[text to display](url/of/contribution)create an individual pull request titled “Community-shortname” where
shortnameis a short name for what you did. approval on this PR by instructor will constitute credit for your graderequest a review on that PR from
@brownsarahm
You want one contribution per {term}`PR`` for tracking