<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sam Oz</title>
    <description>The latest articles on DEV Community by Sam Oz (@sam_econ).</description>
    <link>https://dev.to/sam_econ</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F403318%2F6c07cde4-d1a9-43b4-9e0f-2932ef780d39.png</url>
      <title>DEV Community: Sam Oz</title>
      <link>https://dev.to/sam_econ</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sam_econ"/>
    <language>en</language>
    <item>
      <title>How to make your model training stops when reached a threshold?</title>
      <dc:creator>Sam Oz</dc:creator>
      <pubDate>Sat, 24 Oct 2020 14:42:51 +0000</pubDate>
      <link>https://dev.to/sam_econ/how-to-make-your-model-training-stops-when-reached-a-treshold-4ick</link>
      <guid>https://dev.to/sam_econ/how-to-make-your-model-training-stops-when-reached-a-treshold-4ick</guid>
      <description>&lt;p&gt;Sometimes you need your model training phase stops if you reach a certain threshold. Maybe this way you can avoid overfitting or you have a pipeline and you want it deal with these kind of things automatically. Whatever your reasons are, there is a solutions: Callbacks. According to wikipedia, callback is:&lt;/p&gt;

&lt;p&gt;"In computer programming, a callback, also known as a "call-after" function, is any executable code that is passed as an argument to other code; that other code is expected to call back (execute) the argument at a given time. This execution may be immediate as in a synchronous callback, or it might happen at a later time as in an asynchronous callback. Programming languages support callbacks in different ways, often implementing them with subroutines, lambda expressions, blocks, or function pointers."&lt;/p&gt;

&lt;p&gt;Here is a small chunk of code that you can use in Tensorflow-Keras.&lt;/p&gt;

&lt;p&gt;def train_mnist():&lt;br&gt;
    class myCallback(tf.keras.callbacks.Callback):&lt;br&gt;
        def on_epoch_end(self, epoch, logs={}):&lt;br&gt;
            if(logs.get('acc')&amp;gt;0.99):&lt;br&gt;
              print("\nReached 99% accuracy so cancelling training!")&lt;br&gt;
              self.model.stop_training = True&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mnist = tf.keras.datasets.mnist

(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
callbacks = myCallback()
model = tf.keras.models.Sequential([

  tf.keras.layers.Flatten(input_shape=(28, 28)),
  tf.keras.layers.Dense(512, activation=tf.nn.relu),
  tf.keras.layers.Dense(10, activation=tf.nn.softmax)

])

model.compile(optimizer='adam',
              loss='sparse_categorical_crossentropy',
              metrics=['accuracy'])

# model fitting
history = model.fit(x_train, y_train, epochs=10, callbacks=[callbacks])
# model fitting
return history.epoch, history.history['acc'][-1]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;References:&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/Callback_(computer_programming)"&gt;https://en.wikipedia.org/wiki/Callback_(computer_programming)&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.coursera.org/learn/introduction-tensorflow/"&gt;https://www.coursera.org/learn/introduction-tensorflow/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Laying the Foundation for Deep Learning </title>
      <dc:creator>Sam Oz</dc:creator>
      <pubDate>Sat, 20 Jun 2020 11:08:01 +0000</pubDate>
      <link>https://dev.to/sam_econ/laying-the-foundation-for-deep-learning-1led</link>
      <guid>https://dev.to/sam_econ/laying-the-foundation-for-deep-learning-1led</guid>
      <description>&lt;p&gt;This post is for those are lost along the way just like me.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2lmiZ_-W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ku7a0z6g0ul7jyir35h8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2lmiZ_-W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ku7a0z6g0ul7jyir35h8.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Last week I have started a study marathon and the reason to do that I've realized I am a bit rusty about the foundations of the domain. I tried to find a study partner but since I couldn't find a suitable partner I will be using this platform as a journal to keep me in line and hopefully help couple of you along the way. About me; I am working as a data analyst at PwC(when I started writing this post) so I know statistics and machine learning as a practitioner. I am not coming from CS or Math background, I have studied  Economics therefore I had some math knowledge  kept me going for a while. I am also writing my thesis which is on natural language processing     for that reason alone I must know the mathematical background of neural nets and modern architectures used in NLP such as transformers etc. to explain in academic lingo. Other than that NLP is rapidly growing and improving field and you should be able to read recent academic papers to stay up-to-date on state of the art methodologies. Additionally I should mention I know intermediate level Python and R programming so it won't be in my curriculum. &lt;br&gt;
Last warning: As I mentioned above, I know most of the topics but need a refresher for foundations. So this is not a beginner-friendly walkthrough.&lt;/p&gt;

&lt;p&gt;So enough of me, I will demonstrate my way of getting this done and I hope this helps people with similar background. Here is the path I am and will be walking on for a while:&lt;/p&gt;

&lt;p&gt;1) Linear Algebra &amp;gt; 2) Multivariable Calculus &amp;gt; 3) Neural Networks &amp;gt; 4) Hyperparameter tuning, Regularization and Optimization &amp;gt; 5) Basic Architectures(like RNN,ConvNets, LSTM) &amp;gt; 6) NLP Basics &amp;gt; 7) Attention Models&lt;/p&gt;

&lt;p&gt;Here are the resources for this steps:&lt;br&gt;
1) LINEAR ALGEBRA&lt;br&gt;
First part of the course is Multivariable Calculus&lt;br&gt;
Math for Economists by Jason Kronewetter Ph.D.&lt;br&gt;
&lt;a href="http://ocw.uci.edu/courses/math_4_math_for_economists.html"&gt;http://ocw.uci.edu/courses/math_4_math_for_economists.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Alternative:--You can also go for Gilbert Strang's Linear Algebra course on MIT open courseware.--&lt;br&gt;
&lt;a href="https://ocw.mit.edu/courses/mathematics/18-06-linear-algebra-spring-2010/"&gt;https://ocw.mit.edu/courses/mathematics/18-06-linear-algebra-spring-2010/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) MULTIVARIABLE CALCULUS&lt;br&gt;
Second part of the course is Multivariable Calculus&lt;br&gt;
Math for Economists by Jason Kronewetter Ph.D.&lt;br&gt;
&lt;a href="http://ocw.uci.edu/courses/math_4_math_for_economists.html"&gt;http://ocw.uci.edu/courses/math_4_math_for_economists.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Alternative:--MIT ocw is here for you again.-- &lt;a href="https://ocw.mit.edu/courses/mathematics/18-02sc-multivariable-calculus-fall-2010/1.-vectors-and-matrices"&gt;https://ocw.mit.edu/courses/mathematics/18-02sc-multivariable-calculus-fall-2010/1.-vectors-and-matrices&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3-4-5) DEEP LEARNING-OPTIMIZATION_ARCHITECTURES etc.&lt;br&gt;
Andrew NG's legendary course will be enough for the theory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.coursera.org/specializations/deep-learning#courses"&gt;https://www.coursera.org/specializations/deep-learning#courses&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;6-7) NATURAL LANGUAGE PROCESSING AND ATTENTION MODELS&lt;br&gt;
Recently deeplearning.ai has released a great course for NLP practioners.&lt;br&gt;
&lt;a href="https://www.coursera.org/specializations/natural-language-processing"&gt;https://www.coursera.org/specializations/natural-language-processing&lt;/a&gt;?&lt;/p&gt;

&lt;p&gt;Alternative:--Stanford ocw has released a course while ago but it can be math&amp;amp;programming heavy for some of you. So this is my alternative.&lt;br&gt;
&lt;a href="https://www.youtube.com/playlist?list=PLoROMvodv4rOhcuXMZkNm7j3fVwBBY42z"&gt;https://www.youtube.com/playlist?list=PLoROMvodv4rOhcuXMZkNm7j3fVwBBY42z&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will be sharing my updates about study in the next part.&lt;/p&gt;

&lt;p&gt;___________________&lt;strong&gt;&lt;em&gt;UPDATES&lt;/em&gt;&lt;/strong&gt;______________________&lt;br&gt;
I have finished Linear Algebra part in 8 days. I also took notes I am planning to share.&lt;/p&gt;

&lt;p&gt;I started Multivariable Calculus part. Seems not so hard for now.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>mathematics</category>
      <category>linearalgebra</category>
      <category>neuralnetworks</category>
    </item>
  </channel>
</rss>
