Posts

Showing posts from June, 2021

Statistical Technique

 https://www.kdnuggets.com/2017/11/10-statistical-techniques-data-scientists-need-master.html

Interesting Conversationalist

  People typically shut down when someone talks for more than 40 seconds. I’d recently read that from Mark Goulston, author of   Just Listen,  and this past weekend I had a firsthand experience of it. When some friends of my wife’s visited us for an overnight stay, I discovered the guy, likable enough, was quite a talker. As we sat together in my office after dinner, his verbal stream of consciousness washed over me, and I wondered when he might  pause to take a breath . He didn’t. I felt myself  s hutting down, losing interest not just in listening to him but also in saying anything. The nonstop talking continued at breakfast the next morning, on the bike ride to the beach, and on the way back home. Not one question did he ask of my wife or me. Not surprisingly, I didn’t feel any meaningful connection with him when we said our goodbyes later that day. The History of Mind-Numbing Chitchat How ‘How are you?’ (and other meaningless phrases) came to dominate conver...

Closures in Python

Image
A Closure is a function object that remembers values in enclosing scopes even if they are not present in memory.   Closures are elegant Python constructs. In this article, we’ll learn about them, how to define a closure, why and when to use them. But before getting into what a closure is, we have to first understand what a nested function is and how scoping rules work for them. So let’s get started. Scoping Rules and Nested Functions in Python Whenever a function is executed, a new local namespace is created which represents the local environment that contains names of function parameters and variables assigned inside the function body. We can think of a namespace as a dictionary in which the keys are the object names and the values are the objects themselves. When resolving names, the interpreter first searches the local namespace. If no match exists, it searches the global namespace, which is the module in which function is defined. If no match is still not found, it finally che...

Decorators in Python

  Why Do You Need Decorators? If there is any behavior that is common to more than one function, you probably need to make a decorator. Examples: Checking argument type at runtime Benchmark function calls Cache function results Count function calls Checking metadata (permissions, roles, etc.) Metaprogramming And much more… Decorators With Return Values Suppose we want to know how long each function call takes. Also, functions return something most of the time, so the decorator must handle that as well: def timer_decorator(func): def timer_wrapper(*args, **kwargs): import datetime before = datetime.datetime.now() result = func(*args,**kwargs) after = datetime.datetime.now() print "Elapsed Time = {0}".format(after-before) return result @timer_decorator def sum(x, y): print(x + y) return x + y sum(2, 5) > 7 > Elapsed Time = some time Decorators With Argum...

Better Problem-Solver

Image
  Better Problem-Solver Reinforcing Process with Pixar This past weekend, my family and I purchased tickets to the  Science Behind Pixar   exhibit that is currently showing at the Denver Museum of Nature & Science. Although I haven’t seen a Pixar film in ages, I thought it would be interesting to dig into how these films work under the hood — especially considering that I have no real experience with 3D animation. Seeing all of the steps that were necessary to bring an idea to a finished product was amazing. It also served as a great, tangible example of how important  process  is when it comes to solving any complex problem. Per usual — the entire time I was exploring the exhibit, my mind kept turning back to coding and how I could refine my process, as well as the process of the junior developers I work with every day. Whether Pixar employees are modeling a character, creating digital rigs, or simulating entire environments — each part of the filmmaki...