Basics of Artificial Intelligence – I

For the next several weeks, I’m going to write about some basics of artificial intelligence. AI has been around for decades, but has become particularly popular during the last 20 years thanks to advances in computing. In short, artificial intelligence aims to use computers to solve complex problems quicker and more accurately than human can. Early AI was far different than what we have today. Typically, early AI systems would use complex logic programmed into the system to solve problems. Examples include Dijkstra’s Algorithm or the logic programmed into most games. Modern systems, however, are capable of actually learning for themselves given enough data.

Distance Algorithms

The first set of algorithms necessary to understand AI are distance algorithms. These algorithms are used to determine how close a system is to the right answer. This is necessary when an AI system is learning so that it knows how far off the answer it is. The three main distance algorithms are Euclidian, Manhattan, and Chebyshev. Euclidian distance measures distance as a straight line “as the crow flies” between points on a grid. Manhattan distance travels along one axis and then another, like a taxi traversing New York City. Finally, Chebyshev distance travels like a King on a chessboard alternating between each axis as it gets closer to the target.

In each of the code snippets below, written in Java, two vectors are passed in – v1 and v2 – where each vector represents a data point. In each instance, the size of the vector would determine the dimensionality of the data. For example, a float[2] would be a 2-D vector which could be plotted on a cartesian plot.

Euclidian Distance Algorithm

public static float euclidean(final float[] v1, final float[] v2) {
	float sum = 0;
	for(int i = 0; i < v1.length; ++i) {
		sum += (v1[i] - v2[i]) * (v1[i] - v2[i]);
	}
	return (float)Math.sqrt(sum);
}

In the above code, we iterate through two arrays of floating point numbers and then sum the squares of the differences. Finally, return the square root to determine the distance.

Manhattan Distance Algorithm

public static float manhattan(final float[] v1, final float[] v2) {
	float sum = 0;
	for(int i = 0; i < v1.length; ++i) {
		sum += (float)Math.abs(v1[i] - v2[i]);
	}
	return sum;
}

For the Manhattan distance, we calculate and return the sum of the absolute values of the differences.

Chebyshev Distance Algorithm

public static float chebyshev(final float[] v1, final float[] v2) {
	float result = 0;
	for(int i = 0; i < v1.length; ++i) {
		float d = Math.abs(v1[i] - v2[i]);
		result = Math.max(d, result);
	}
	return result;
}

Finally, in the Chebyshev algorithm, the value is the maximum dimension in any direction.

Jupyter & Scikit-Learn for Artificial Intelligence

Jupiter

Many people are interested in artificial intelligence and machine learning, but what framework should you start out with to hit the ground running fast? Jupyter and Scikit-Learn!

Jupyter

Jupyter is a web-based development environment well-suited for Python development and artificial intelligence. What makes it great for AI development is the nature of the web platform. You can add code blocks, generate images and charts, or add markdown to document what you’re doing. What is also useful is that each block of code within the IDE can be executed as needed by clicking the run button at the top. This is something you will do over and over as you tune your AI parameters to get better accuracy.

The Jupiter Notebook is installed directly on your computer, so you can access local files. This is critical for being able to access the data you will use to train your AI model and ensures optimal performance when using large data sets.

Scikit-Learn

There are countless frameworks for AI, but Scikit-Learn is my favorite. Since it’s a Python-based framework, it’s relatively easy for anyone to work with. Furthermore, since Python is heavily used in artificial intelligence research, you’re using a tool well known to other practitioners in the field. Scikit-Learn supports just about anything you could want for AI including logistic regression, k-nearest neighbors, neural networks, naive bayes, and support vector machines. Even better, Scikit-learn makes it so simple to implement that you don’t really need to know much about the underlying technology.

Part of what makes scikit-learn so useful is how easy it is to create charts or graphs. This can include a typical confusion matrix or any plot for your data. This can be really powerful in AI to better understand the data and what relationships may exist.

Getting Started

If you’re interested in getting started, visit jupyter.org to download their IDE. Then, visit scikit-learn.org for installation instructions. If you’re familiar with Python, you’re ready to start with the scikit-learn tutorial on their website. If not, take a trip to YouTube and find some videos on Python development!

Language Learning Tools

Language

As we start a new school year, many students – both in high school and college – will be learning a new language. For most of my life, I have been fascinated with foreign languages and spend time every day honing my skills. While I spend much time learning from books, there are some great tools for the more tech savvy that can make language learning more fun.

Pimsleur Language Programs

One of my favorite tools, particularly for working toward conversational skills, is Pimsleur. Their product typically provides 30 half-hour recordings that guide the listener from no language skill through the path to conversational knowledge. I used Pimsleur Chinese 1-4 to help improve my Chinese proficiency – and was pleased with the results. While Pimsleur can be expensive, it’s probably one of the best tools if your ultimate goal is fluency. Note, while they have traditionally been a CD-based program, they have have an app too.

Duolingo

Another favorite for language learning is Duolingo. This is probably the best-known mobile application for language development. Duolingo offers a variety of languages from typical European languages such as German, French, and Spanish to less common languages such as Yiddish and even fictional languages like Klingon. In my experience, Duolingo works best with languages sharing our alphabet. But if you’re willing to work a little harder, their Asian language tools are pretty awesome too. Duolingo has some really nice features such as weekly competitions on the leaderboard and some social aspects too.

Japanese Dungeon

As I’ve started trying to learn Japanese, I came across this app. It’s particularly fun as it’s a good mix of game and learning. This particular tool is great for learning the Japanese scripts. In addition to Japanese Dungeon, versions exist for Korean, Russian, and a variety of European languages. What makes this app so fun is that it plays like an 8-bit game where you fight orcs. Get a character right and you hit an orc. Otherwise, you will be hit. As you progress, you can unlock more characters with different stats and level your character up to deal more damage.

Other Tools

The above are my current favorites. However, there are countless other tools out such as Rosetta Stone, Hello Chinese, Drops, and too many others to enumerate. So, if you are looking to expand your language skills, head to your mobile app store and get learning!

Impact of Social Media Bias

Scales

Since last year’s election, I have been substantially less involved with blogging and social media marketing. While we are all entitled to our political views, I will keep mine to myself and simply talk about how social media bias has negatively impacted social marketing.

Demographics

As a small business owner with an MBA, I am all too familiar with demographics. When I consider any marketing efforts, I have to consider who my primary market is and how I can reach them. For instance, marketing to children or teens would be ineffective for me as a software company. So, that means I have to ponder who does buy my services and how I can reach those markets. That also means knowing the demographics of my local area and their interests. While there are always outliers, I have determined that a sizable number of my customers are middle-aged or older white men with conservative political views. Of course, some of my customers are women or politically liberal – they just form the minority of my market in this area.

Reaching my Demographic

Once I’ve determined my demographic, the next step is to find ways to reach them. Newspapers are not likely to effectively market to millennials, for example. So I need to find the media used by my demographic. Of course, a substantial number of Americans are active on one or more social media platforms. Specifically, Facebook, LinkedIn, Twitter, and Instagram provide access to a substantial number of consumers of all demographics. These tools provide cheap advertising access to a large cross-section of Americans – in my demographic as well as other demographics I would like to attract to my business.

The Impact of Bias

Unfortunately, as last year progressed, there were more and more stories of political bias by the social media platforms. They felt it was their job to monitor political content and, ultimately, to deplatform people they did not agree with. Unfortunately, for those relying on social media for advertising, it meant that some demographics were substantially less present on social media. Or, worse yet, that those demographics had disengaged the platforms entirely. That means fewer people for me to market to and less desire to advertise or engage in social media.

Neutrality

Regardless of your political views, the neutrality of social media is essential not only for its viability as a marketing platform, but also for the long-term financial viability of any social media company. Alienating half of the population by politically-motivated censorship will do nothing but ensure the eventual demise of social media and will cause businesses to find alternative advertising means to reach their target demographic.

Conclusion

Whether you are a republican or democrat, if you’re involved in business you recognize the importance of advertising. Likewise, you are inevitably aware of conservative friends or political figures who have fled due to censorship. This must stop – not only because it discourages the open debate of ideas – but because it damages the platforms as well as the utility of social media marketing.

What You Need To Know About Apps

Apps

As companies prepare to enter the new year, some will embrace new technologies like mobile applications. While a large number of businesses already have apps for both Android and iOS, may smaller business do not. Those businesses will have to decide if the investment will provide value for their users as well as their organization. To help make that decision, it’s useful to better understand the mobile app ecosphere.

Android or iOS?

The most important question is what devices you are targeting with a mobile application. Are you only looking to support iPhones, or do you want Android too? This decision will drive the rest of the decisions you make. While most organizations want an application for both platforms, you may be looking to create apps for a niche market better serviced by one or the other. For example, if you want to create an app that will target a handheld barcode scanner and label printer, you’ll want to develop for Android only as iOS doesn’t support that that hardware.

Native or Hybrid?

The next question is if you want the app to be developed natively or using hybrid technologies. The difference is the programming environments used as well as the development time and costs. While native apps almost always ‘feel’ better than their hybrid counterparts, they also require developing separately for both platforms – which increases the development time as well as the cost. Conversely, hybrid apps can be written once and will work well on both devices.

Costs & Monitization

To place an app on either store, you will need a license. For Google, this is a nominal one-time purchase, but requires an annual license from Apple. If your organization is a non-profit or business that doesn’t wish to pay an annual license fee, you may wish to skip on Apple development. If you’re planning to sell your app on the store, note that both Apple and Google take a 30% cut of all sales. This can be significant cost, but the large market available to you makes it well worth the cost.

Approval

After you’ve created your app, it will need to be reviewed. Both Google and Apple have staff who download apps to verify compliance with their rules. Note, it is possible for your app to be rejected, in which case you will have to make modifications and resubmit.

User Acceptance

One last point I’ve learned is to make sure your app services a purpose. I’ve had several clients create an app they thought was great only to find that nobody downloaded or used the app. This can be disappointing and lead to a substantial loss to the business. The best way to avoid this is to ensure that you’re creating an application that fills an actual user need – not just something that you perceive as a need.

Conclusion

The decision to make an app can be a big one with lots of options and potential costs. Take time to research the market and ecosphere before you jump in and you will have a much more successful app launch!

Cool Tech Gifts for Christmas

Circuit Board

With Thanksgiving behind us, it’s time to start looking for gifts for the important people in our lives. If one of those people happens to be a techie, what can you get them? Particularly if they’re a teen? Here are some ideas of cool tech toys for the people on your list.

Electronics

There are some really great products out there for learning more about electronics. One of my favorites is littleBits. Each piece contains a separate electronic component – such as a speaker, button, or power cell – than can be connected magnetically to create circuits. With a variety of sets available, you can create all kinds of projects.

Another cool electronic toy is Snap Circuits. Snap Circuits are more like a traditional electronics learning set, but instead of using wires connected to metal springs, the pieces are snapped on a board with metal buttons. These buttons connect pieces together to create the electrical circuitry.

Both of these sets are appropriate for children as young as elementary school and are great for learning the basics of electrical engineering with countless online and print books available for project ideas.

Microcontrollers

For the techie with a bit more experience in electronics, a microcontroller may be the perfect gift. Today, there are countless microcontrollers available. However my two favorites are the Arduino and the micro:bit.

The micro:bit was developed by the BBC to teach children more about electronics and programming. It’s a small device, but it packs a lot of cool features including a grid of LEDs, an accelerometer, buttons, and built-in bluetooth support. They’re very easy to program and fairly inexpensive. NOTE: buy two, you’ll need them to play with the bluetooth functionality!

For more mature electronics enthusiasts, the Arduino is amazing. In fact, it is well beyond a toy for learning and has transcended into the hands of professionals creating prototypes and products. Countless kits exist on sites such as Amazon that include wires, motors, LEDs, buttons, resistors, and countless other components to build just about anything. In addition, since Arduino is truly the industry leader, it’s easy to find books and online resources for help as well as inspiration.

Microcomputers

With more power than microcontrollers and more versatility as well, microcomputers offer unlimited opportunities to create and explore. The industry leader in this real has long been the Raspberry Pi. About the size of a credit card and costing substantially less than a typical computer, the Raspberry Pi is an excellent platform for learning and exploration. You can interface the Pi with custom hardware, learn to program with Scratch, create a custom video game console, or explore countless other options. And, much like the Arduino, online retailers have numerous kits with all kinds of parts to aid in learning and fun.

A newcomer to the microcomputer realm, the NVIDIA Jetson Nano offers programmers and techies a new real to explore – artificial intelligence! This small box (about the size of a Raspberry Pi) features an NVIDIA graphics processor specifically configured to perform the intense number crunching associated with AI processing. This is an excellent gift idea for those who already have some background in programming and electronics and want to take their ideas to the next level!

Conclusion

This is a great time to be a techie. With countless low-cost gadgets available to encourage exploration and experimentation, the barrier to learning technology has never been lower! Take time to explore the products out there and buy something that may encourage someone in your life to join the tech revolution!

Simple Tips to Avoid Scammers

Gangster

It seems that every day criminals find new ways to separate victims from their money. However, most of these tricks can be avoid with three simple rules.

Assume all email is junk mail until proven otherwise

Email is the easiest way to scam people. It takes little effort to send out thousands of messages, and scammers win if even a small percentage of people act on their messages.

Don’t click on links. If you believe the email to be from a reputable source, go directly to their website instead of using the email link

Don’t open attachments. This is particularly true for unsolicited Microsoft Office documents such as Word and Excel, but equally important for any other attachment. If you believe the attachment to be valid, contact the sender by phone and confirm they sent it.

Contact the sender directly. If you get a message claiming to be from someone important in your organization and asking you to do something that seems odd, contact the person and verify authenticity.

Assume all phone calls are spam

Suspect local numbers. If a caller claims to be from your credit card company or the IRS, but their phone number is from your area, it’s a scam.

Ignore callers from India. Does the speaker have an Indian accent? It’s a scam. The overwhelming majority of spam calls originate from call centers in India.

Caller can’t provide you with information. Does the caller know your name, address, account number, or other information? If not, are they really your bank? I doubt it.

Avoid entering data in unencrypted sites

Check for the secure icon in your browser. If the web site you’re visiting isn’t encrypted, be skeptical. Particularly if they’re asking you to enter personal information. Never, under any circumstances, enter your credit card information in a non-secure site.

Conclusion

The simple answer for security in the modern age can be summed up “trust no one”. Assume everyone is out to scam you, and you’re probably not far from the truth. If you want to conduct business with an entity, go to their web page directly or contact them on the phone. Always assume the incoming solicitations you receive are from people trying to cheat you and you will likely avoid most scammers.

Skills All Developers Should Know

Tools

When I talk with developers, it’s amazing how many of them are disappointed with the limited job opportunities available to them. Often, the problem is that they lack many of the common skills required to be an effective programmer in today’s market. These developers have managed to become specialists in a very specific technology stack which isn’t widely used elsewhere. I’ll tell them some things they should learn, and – surprisingly – they’ll often argue that the specific skill I mentioned isn’t that useful. What are those skills?

HTML

First and foremost, every developer today needs to know HTML. In our web-based world, it’s hard to find work that doesn’t require HTML at some point. This is obviously true for web development, but is equally valuable with hybrid mobile technologies such as Cordova or Ionic. Or, maybe you need to create documentation for you application that will be accessed on the web.

JavaScript

While every developer may use a different programming language for backend development, we all use JavaScript for web programming. But JavaScript goes well beyond that. Today, JavaScript can be used for developing backend services with Node or even interfacing with Arduino hardware with the Johnny5 library.

Git

Developers need to be comfortable with Git from the command line. GUIs are nice, but when you need to automate a build script or download code from a command prompt on a remote computer, the Git command line is essential.

BASH

Like it or not, much of the cloud runs on Linux servers. As such, a knowledge of BASH is essential in today’s world. While many developers prefer a Windows only world, it’s just not the case when you have to deal with Google or AWS cloud services.

SQL

It’s amazing to me how many junior developers are unfamiliar with SQL. In today’s marketplace, nearly every application needs to interact with a database somewhere. Whether it’s an enterprise application using Oracle or an Android app using SQLite, SQL is the common way to interact with a database.

Conclusion

It may be noted that – other than JavaScript – no programming languages are on the list. Whether you develop in C, C++, Java, Swift or some other language, the above skills will apply. There are countless toolkits and frameworks, languages and environments. However, nearly all of them will require some mix of knowledge of HTML, JavaScript, Git, Bash, and SQL

Attitude Matters

Bad Attitude

Anybody who has ever looked at job requirements for technical staff has probably noticed the huge number of skills required. This may include programming languages, hardware platforms, frameworks, protocols, or countless other technical specifications. However, what you will see far less often is interpersonal skills or attitude. In reality, these soft skills are typically far more valuable.

This week, I overheard an aspiring programmer discuss how he found it “mentally draining pretending to care about business needs our values”. I immediately jumped in to try to correct his errant thinking. As the discussion continued, he made it abundantly clear that he only cared about money. In fact, the only reason he was going to school for technology was to make money.

While many people chose their profession based on financial factors, money should never be the primary motivation. Why? Because study after study has found that money is a poor motivator of behavior. Instead, people motivated by the intrinsic characteristics of a job are far more successful. For example, as a programmer, I’m motivated by helping business transform their operations through technology and by the challenge of the problem. While a large number of the applications are, in themself, boring; solving complex problems and helping businesses grow is always exciting.

For the individual trying to find a job, learn to be motivated by the job instead of the money. Not only will it help you perform better, it will help you develop a more positive attitude.

In the end, most business owners would rather have a less technically competent individual with a positive attitude than a more skilled individual with a poor attitude. For the business, they can train the desired skills, but fixing a poor attitude is far more difficult.

Backups Are Not Optional

Drives

Recently, I visited a customer site for what seemed like a simple request – to update their Windows computer. However, in the end, the machine had to be reformatted. The customer was very worried that they would lose critical data on their system. That didn’t happen, but I was concerned that the customer wasn’t performing backups on what he considered to be critical operational data.

Today, failure to backup important data is not excusable. With the advent of cloud services as well as cheap data storage, customers have countless options for ensuring their data is always available. Regardless of the operating system or situation, everyone should be performing regular backups of critical information.

Backup Options

For Mac users, Apple’s Time Machine is the way to go. The gold standard for computer backups, Time Machine automatically backups up your entire system whenever a configured hard drive is connected to the computer. Not only is it easy to configure and implement, backups couldn’t be easier. During setup of a new Mac computer, simply plug in the Time Machine drive and the OS will take care of moving everything to a new system. It could not possibly be easier. Additionally, Apple’s iCloud drive is an incredibly cheap cloud-based backup option. The free iCloud storage allows up to 5 gigs while paid solutions start at only .99 cents per month.

Unfortunately, Windows users don’t have anything as nice as Time Machine. However, Microsoft’s OneDrive allows free storage of 5 gigs (like iCloud) and up to 1 TB for only $6.99 per month. With automatic syncing to the cloud, OneDrive can quickly – and easily – protect mission critical data.

In addition to the above, countless other options exist. Google Drive, a service similar to OneDrive or iCloud, allows 15 gigs of free storage. For developers, both BitBucket and GitHub provide off-site storage of source code. For your cell phone, Google Photos can backup every selfie you take so you never have to worry about losing the pictures on your phone.

Conclusion

In the end, it doesn’t really matter what service you use or how you do your backups. What matters is that you’re doing them. For me, as a business owner, the loss of my business data would be catastrophic. So, I have implemented various backups to preserve critical files. If my computer blows up today, I’ve got nothing to fear – I’ll be back up and running tomorrow.

If you are concerned about what would happen to your business in the event of a computer crash or catastrophic event, contact someone in your IT department. If you don’t have an IT department feel free to contact Talixa Software for assistance.