Please enable JavaScript.
Coggle requires JavaScript to display documents.
CPAW - Coggle Diagram
CPAW
MVP with CPA
Implement and Integrate Basic Core features of CPA
FetchHandler
construct fetchHandler with arguments:
UploadDataProvider instance,
GeneralClassifier instance,
API: getNDataURLs
return pair where first is an array of data urls for images
and second is an array of imkey,obkey pairs. take in the fetchType whether random, positive, or negative
Random
get N random obkey,imkey pairs from UploadDataProvider instance API call: getRandomNPairs()
input the random obkey,imkey pairs into function calls to
pairToDataURL() to get data urls and return array of them
Positive/negative
get N random obkey, imkey pairs
get N random obkey,imkey pairs from UploadDataProvider instance API call: getRandomNPairs()
get the corresponding rows of object data and pass them into the classifier to get their predicted labels
use UploadDataProvider instance's pairToObjectDataRow() method calls to make an array of data objects corresponding to the array of obkey, imkeys
get the column names that we care about for machine learning with function call to UploadDataProvider instance with method getFeaturesToUse()
Pass data objects and column names into GeneralClassifier instance's predict function and get an array of 0s and 1s meaning whether each is negative or positive respectively
add the imkey, obkeys corresponding to positive/negative labels to the return array
loop until return array is N or we reach the max number of iterations (let's make it 10 for now)
after the loop is done,
input the random obkey,imkey pairs into function calls to
pairToDataURL() to get data urls and return array of them
Image Grid Manager
construct with a list of dataurls and a list of pairs of the same length where each pair has one image key and one object key. Instance variables need to include list of dataurls, list of pairs, and length of the list
Each image object starts out with "unclassified" field , when drag and dropped give new tag whether now in positive or negative grid
API: get imkeys, obkey pairs for: unclassified field, negative field, and positive field in image data state
API: get data url by index
API: set grid placement property by index and gridType
API: get number of images
API: set internal list of imkey, obkey pairs with input of list of indices and the gridType
General Classifier
Download Result
Download classifier.json spec
userDownloadJSON function
Download newtrainingset.txt
userDownloadText function
Construct Classifier
Fit to Dataset
convert dataset to tensors
start
training
input dataset, labels, column_names
save training set for later download
LogisticRegression
Predict Dataset
take in subarray of object data, and column names array of strings
output array of labels (0 and 1 for negative and positive)
render confusion matrix
Upload Cell Data
Make UploadDataProvider class
API: get random N rows of object_data
API: get random row of object_data
Initialize on upload file
API: get initial training data set
API: getRandomNPairs() get random N (imkey,obkey) pairs
API: pairToDataURL() return data URL for merged 3 channel image by imkey and obkey
construct 3 channel image objects by imkey
store in canvas, slicing by obkey derived nuclei location
convert canvas data url and remove canvas
API: pairToObjectDataRow(); get row of object_data by imkey and obkey
API: getFeaturesToUse() get features to use (column names)
Core Iteration Manager
Basic Easy Sequence
DataUploadedStandby State
Allow Fetch Button Only
Construct UploadDataProvider
construct one instance of GeneralClassifier with initial training set from UploadDataProvider
call CoreIterationManager.onUploadButton() , fileListObject argument
Fetching Image State
Fetching Random State
Construct FetchHandler with GeneralClassifier and UploadDataProver instances as argument
get random N data dataurls from FetchHandler
and pass into construction of Image Grid Manager
Allow No Interaction
Fetching Positive/Negative State
Allow No interaction
Cons
call CoreIterationManager.onFetchButton(),
Training Model State
Allow No Interaction
set grid types of list of indices in
ImageGridManager
get list of imkey obkey pairs for positive and negative bins
get subarray of object_data which corresponds to those imkey obkeys and construct array of 0s and 1s where 0s correspond to negative binned and 1s to positive
Construct GeneralClassifier with input of this subarray and label array
DragandDrop State
RandomFetchComplete State
Allow Dragging between
unclassified grid and both
the positive and negative state
PositiveFetchComplete State
Allow Dragging between
unclassified grid and
negative grid
NegativeFetchComplete State
Allow Dragging between
unclassified grid and
positive grid
Initial State
Allow Upload Button Only
Construct This class on app load