src/classifier.py
def train(self, training_inputs, training_classes=None):
        """
        Fit the model to the training data using keras optimization builtins.

        For example, we may want to minimize cross-entropy as a performance
        measure. This is built-in to keras (I'm almost positive).

        Params
        ------
        training_inputs: (tf.tensor)
            Collection of images to be trained on
        training_classes: (tf.tensor)
            Collection of associated classes for each image 

        Returns
        -------
        [N/A called for side-effects only]

        Preconditions
        -------------
        The ith training input corresponds to the ith training class
        """
        #compile the model
        # https://datascience.stackexchange.com/questions/41921/sparse-categorical-crossentropy-vs-categorical-crossentropy-keras-accuracy
        #self.compile(optimizer="adam", loss="sparse_categorical_crossentropy", metrics=["accuracy"])
        self.compile(optimizer="adam", loss="categorical_crossentropy", metrics=["accuracy"])

        #train the model
        if training_classes is None:
            self.fit(training_inputs, epochs=5)
        else:
            self.fit(x=training_inputs, y=training_classes, epochs=5)

        Fit the model to the training data using keras optimization builtins.

        For example, we may want to minimize cross-entropy as a performance
        measure. This is built-in to keras (I'm almost positive).

        Params
        ------
        training_inputs: (tf.tensor)
            Collection of images to be trained on
        training_classes: (tf.tensor)
            Collection of associated classes for each image 

        Returns
        -------
        [N/A called for side-effects only]

        Preconditions
        -------------
        The ith training input corresponds to the ith training class
        
Fit the model to the training data using keras optimization builtins.
For example, we may want to minimize cross-entropy as a performance
measure. This is built-in to keras (I'm almost positive).

Params

(tf.tensor)
Collection of images to be trained on
training_classes: (tf.tensor)
Collection of associated classes for each image

Returns

[N/A called for side-effects only]

Preconditions

The ith training input corresponds to the ith training class
Fit the model to the training data using keras optimization builtins . For example we may want to minimize cross - entropy as a performance measure . This is built - in to keras ( I ' m almost positive ) . Params ( tf . tensor ) Collection of images to be trained on training_classes : ( tf . tensor ) Collection of associated classes for each image Returns [ N / A called for side - effects only ] Preconditions The ith training input corresponds to the ith training class
def train(self, training_inputs, training_classes=None):
        self.compile(optimizer="adam", loss="categorical_crossentropy", metrics=["accuracy"])
        if training_classes is None:
            self.fit(training_inputs, epochs=5)
        else:
            self.fit(x=training_inputs, y=training_classes, epochs=5)
def train ( self , training_inputs , training_classes = None ) : self . compile ( optimizer = "adam" , loss = "categorical_crossentropy" , metrics = [ "accuracy" ] ) if training_classes is None : self . fit ( training_inputs , epochs = 5 ) else : self . fit ( x = training_inputs , y = training_classes , epochs = 5 )
Fit the model to the training data using keras optimization builtins.
Fit the model to the training data using keras optimization builtins .
"""
        Fit the model to the training data using keras optimization builtins.

        For example, we may want to minimize cross-entropy as a performance
        measure. This is built-in to keras (I'm almost positive).

        Params
        ------
        training_inputs: (tf.tensor)
            Collection of images to be trained on
        training_classes: (tf.tensor)
            Collection of associated classes for each image 

        Returns
        -------
        [N/A called for side-effects only]

        Preconditions
        -------------
        The ith training input corresponds to the ith training class
        """ #compile the model # https://datascience.stackexchange.com/questions/41921/sparse-categorical-crossentropy-vs-categorical-crossentropy-keras-accuracy #self.compile(optimizer="adam", loss="sparse_categorical_crossentropy", metrics=["accuracy"]) #train the model
self
training_inputs
training_classes