Laura Fres, Author at ProdSens.live https://prodsens.live/author/laura-fres/ News for Project Managers - PMI Fri, 14 Jun 2024 15:20:33 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://prodsens.live/wp-content/uploads/2022/09/prod.png Laura Fres, Author at ProdSens.live https://prodsens.live/author/laura-fres/ 32 32 NumPy’s Argmax? How it Finds Max Elements from Arrays https://prodsens.live/2024/06/14/numpys-argmax-how-it-finds-max-elements-from-arrays/?utm_source=rss&utm_medium=rss&utm_campaign=numpys-argmax-how-it-finds-max-elements-from-arrays https://prodsens.live/2024/06/14/numpys-argmax-how-it-finds-max-elements-from-arrays/#respond Fri, 14 Jun 2024 15:20:33 +0000 https://prodsens.live/2024/06/14/numpys-argmax-how-it-finds-max-elements-from-arrays/ numpy’s-argmax?-how-it-finds-max-elements-from-arrays

NumPy is most often used to handle or work with arrays (multidimensional, masked) and matrices. It has a…

The post NumPy’s Argmax? How it Finds Max Elements from Arrays appeared first on ProdSens.live.

]]>
numpy’s-argmax?-how-it-finds-max-elements-from-arrays

NumPy is most often used to handle or work with arrays (multidimensional, masked) and matrices. It has a collection of functions and methods to operate on arrays like statistical operations, mathematical and logical operations, shape manipulation, linear algebra, and much more.

Argmax function

numpy.argmax() is one of the functions provided by NumPy that is used to return the indices of the maximum element along an axis from the specified array.

Syntax

numpy.argmax(a, axis=None, out=None)

Parameters:

  • a – The input array we will work on

  • axis – It is optional. We can specify an axis like 1 or 0 to find the maximum value index horizontally or vertically.

  • out – By default, it is None. It provides a feature to insert the output to the out array, but the array should be of appropriate shape and dtype.

Return value

The array of integers is returned with the indices of max values from the array a with the same shape as a.shape with the dimension along the axis removed.

Finding the index of the max element

Let’s see the basic example to find the index of the max element in the array.

Working with a 1D array without specifying the axis

# Importing Numpy
import numpy as np

# Working with a 1D array
inp_arr = np.array([5, 2, 9, 4, 2])

# Applying argmax() function
max_elem_index = np.argmax(inp_arr)

# Printing index
print("MAX ELEMENT INDEX:", max_elem_index)

Output

MAX ELEMENT INDEX: 2

Working with a 2D array without specifying the axis

When we work with 2D arrays in numpy and try to find the index of the max element without specifying the axis, the array we are working on has the element index the same as the 1D array or flattened array.

The index of the max element in a 2D array without specifying the axis

# Importing Numpy
import numpy as np

# Creating 2D array
arr = np.random.randint(16, size=(4, 4))

# Array preview
print("INPUT ARRAY: n", arr)

# Applying argmax()
elem_index = np.argmax(arr)

# Displaying max element index
print("nMAX ELEMENT INDEX:", elem_index)

Output

INPUT ARRAY: 
 [[ 5  5  4 12]
 [12 15 13  0]
 [11 13  2  6]
 [ 6  8  8  9]]

MAX ELEMENT INDEX: 5

Finding the index of the max element along the axis

Things will change when we specify the axis and try to find the index of the max element along it.

When the axis is 0

When we specify the axis=0, then the argmax function will find the index of the max element vertically in the multidimensional array that the user specified. Let’s understand it by an illustration below.

Indices of the max elements along axis 0

In the above illustration, argmax() function returned the max element index from the 1st column which is 1 and then returned the max element index from the 2nd column which is again 1, and the same does for the 3rd and the 4th column.

# Importing Numpy
import numpy as np

# Creating 2D array
arr = np.random.randint(16, size=(4, 4))

# Array preview
print("INPUT ARRAY: n", arr)

# Applying argmax()
elem_index = np.argmax(arr, axis=0)

# Displaying max element index
print("nMAX ELEMENT INDEX:", elem_index)

Output

INPUT ARRAY: 
 [[ 8  6 10  3]
 [ 4  5  9  1]
 [ 6 15 13 13]
 [ 4 14 15 13]]

MAX ELEMENT INDEX: [0 2 3 2]

When the axis is 1

When we specify the axis=1, the argmax function will find the index of the max element horizontally in the multidimensional array that the user specified. Let’s understand it by an illustration below.

Indices of the max elements along axis 1

In the above illustration, argmax() function returned the max element index from the 1st row which is 2 and then returned the max element index from the 2nd row which is 1, and the same does for the 3rd and the 4th row.

Code example

# Importing Numpy
import numpy as np

# Creating 2D array
arr = np.random.randint(12, size=(4, 3))

# Array preview
print("INPUT ARRAY: n", arr)

# Applying argmax()
elem_index = np.argmax(arr, axis=1)

# Displaying max element index
print("nMAX ELEMENT INDEX:", elem_index)

Output

INPUT ARRAY: 
 [[ 7  8  0]
 [ 3  0 11]
 [ 7  6  0]
 [10  8  1]]

MAX ELEMENT INDEX: [1 2 0 0]

Multiple occurrences of the highest value

Sometimes, we can come across multidimensional arrays with multiple occurrences of the highest values along the particular axis, then what will happen?

The argmax() function will return the index of the highest value that occurs first in a particular axis.

Illustration showing multiple occurrences of the highest values along axis 0.

Multiple occurrences of the highest values along axis 0

Illustration showing multiple occurrences of the highest values along axis 1.

Multiple occurrences of the highest values along axis 1

Code example

# Importing Numpy
import numpy as np

# Defining the array
arr = np.array([[2, 14, 9, 4, 5],
                [7, 14, 53, 10, 4],
                [91, 2, 41, 6, 91]])

# Displaying the highest element index along axis 0
print("MAX ELEMENT INDEX:", np.argmax(arr, axis=0))

# Displaying the highest element index along axis 1
print("nMAX ELEMENT INDEX:", np.argmax(arr, axis=1))

# Flattening the array, making it a 1D array
flattened_arr = arr.flatten()
print("nThe array is flattened into 1D array:", flattened_arr)

# Displaying the highest element index
print("nMAX ELEMENT INDEX:", np.argmax(flattened_arr))

Output

MAX ELEMENT INDEX: [2 0 1 1 2]

MAX ELEMENT INDEX: [1 2 0]

The array is flattened into 1D array: [ 2 14  9  4  5  7 14 53 10  4 91  2 41  6 91]

MAX ELEMENT INDEX: 10

Explanation

In the above code, when we try to find the indices of the max elements along the axis 0, we got an array with values [2 0 1 1 2], if we look at the 2nd column, 14 is the highest value at the 0th and the 1st index, we got 0 because the value 14 at the 0th index occurred first when finding the highest value.

The same goes for the array we obtained in the second output when we provided the axis 1, in the 3rd row, 91 is the highest value at the 0th and the 4th index, the value 91 at the 0th index occurred first when finding the highest value hence we got output 0.

Using the out parameter

The out parameter in numpy.argmax() function is optional and by default it is None.

The out parameter stores the output array(containing indices of the max elements in a particular axis) in a numpy array. The array specified in the out parameter should be of shape and dtype, the same as the input array.

Code Example

# Importing Numpy
import numpy as np

# Creating array filled with zeroes which then be replaced
out_array = np.zeros((4,), dtype=int)
print("ARRAY w/ ZEROES:", out_array)

# Input array
arr = np.random.randint(16, size=(4, 4))
print("INPUT ARRAY:n", arr)

# Storing the indices of the max elements(axis=1) in the out_array
print("nAXIS 1:", np.argmax(arr, axis=1, out=out_array))

# Storing the indices of the max elements(axis=0) in the out_array
print("nAXIS 0:", np.argmax(arr, axis=0, out=out_array))

Output

ARRAY w/ ZEROES: [0 0 0 0]
INPUT ARRAY:
 [[ 4  2 14 15]
 [ 6 15  2  1]
 [13  6 13  3]
 [ 5  1 13  9]]

AXIS 1: [3 1 0 2]

AXIS 0: [2 1 0 0]

Explanation

We created an array filled with zeroes named out_array, and we defined the shape and dtype same as the input array and then used the numpy.argmax() function to get the indices of the max elements along the axis 1 and 0 and stored them in the out_array that we defined earlier.

The numpy.zeros() has by default dtype float that’s why we defined the dtype in the above code because our input array has the dtype=int.

If we didn’t specify the dtype in the above code, it would throw an error.

# Importing Numpy
import numpy as np

# Creating array filled with zeroes without specifying dtype
out_array = np.zeros((4,))
print("ARRAY w/ ZEROES:", out_array)

# Input array
arr = np.random.randint(16, size=(4, 4))
print("INPUT ARRAY:n", arr)

print("nAXIS 1:", np.argmax(arr, axis=1, out=out_array))

Output

ARRAY w/ ZEROES: [0. 0. 0. 0.]
INPUT ARRAY:
 [[14  9  3  4]
 [ 9  2  4  8]
 [ 5  1  9  1]
 [ 6  0 10  7]]

TypeError: Cannot cast array data from dtype('float64') to dtype('int64') according to the rule 'safe'

Conclusion

That was the insight of the argmax() function in NumPy. Let’s review what we’ve learned:

  • numpy.argmax() function returns the index of the highest value in an array. If the maximum value occurs more than once in an array(multidimensional or flattened array), then the argmax() function will return the index of the highest value which occurred first.

  • We can specify the axis parameter when working with a multidimensional array to get the result along a particular axis. If we specify axis=0, then we’ll get the index of the highest values vertically in the multidimensional array, and for axis=1, we’ll get the result horizontally in the multidimensional array.

  • We can store the output in another array specified in the out parameter; however, the array should be compatible with the input array.

That’s all for now

Keep Coding✌✌

The post NumPy’s Argmax? How it Finds Max Elements from Arrays appeared first on ProdSens.live.

]]>
https://prodsens.live/2024/06/14/numpys-argmax-how-it-finds-max-elements-from-arrays/feed/ 0
The power of micro-moments in product marketing https://prodsens.live/2024/06/03/micro-moments-in-product-marketing/?utm_source=rss&utm_medium=rss&utm_campaign=micro-moments-in-product-marketing https://prodsens.live/2024/06/03/micro-moments-in-product-marketing/#respond Mon, 03 Jun 2024 16:20:06 +0000 https://prodsens.live/2024/06/03/micro-moments-in-product-marketing/ the-power-of-micro-moments-in-product-marketing

For most of us, our daily lives are completely intertwined with digital tools. The simple act of communicating,…

The post The power of micro-moments in product marketing appeared first on ProdSens.live.

]]>
the-power-of-micro-moments-in-product-marketing

The power of micro-moments   in product marketing

For most of us, our daily lives are completely intertwined with digital tools. The simple act of communicating, searching for information and shopping has been transformed in ways we could not have imagined just two decades ago. 

Gone are the days spent wandering the aisles, searching and comparing products. A staggering 5.9 million Google searches every minute in 2023 is striking evidence of our collective thirst for immediacy, a clear indicator of how the traditional shopping trip has evolved into a series of quick, decisive moments.

A survey conducted in the US and Canada reveals that, on average, consumers now research online before 61% of their purchases. This represents a 25% increase from 2022, highlighting a significant shift in shopping behaviour.

In the midst of this change, Google’s introduction of the concept of “micro-moments” years ago has never been more relevant. This notion, which eloquently captures the essence of the evolving consumer journey, is proving to be a great way to establish meaningful connections with your audience.

In this article, we will unpack the concept of micro-moments and discover how we, as marketers, can harness their power.

Understanding micro-moments

Micro-moments occur when a person instinctively picks up a device to satisfy an immediate need, query or desire. These moments are full of intent. They represent the desire to learn something, do something, go somewhere, or buy something. 

The essence of micro-moments lies in their immediacy. Users expect to receive exactly what they‘re looking for when they’re looking for it. This demand for instant and relevant content requires companies to anticipate and develop specific strategies that respond to needs as they happen.

The power of micro-moments   in product marketing
Source: Google (2016)

Micro-moments introduce a richer view of the traditional customer journey. It’s no longer about a few critical touchpoints, but a constellation of moments, each offering a unique opportunity to capture and enhance the customer experience. 

Let me clarify this concept a little. Let’s consider a familiar scenario of choosing a holiday destination. Picture it:

  • Want-to-know moments: Max is commuting to work with his eyes glued to his phone as he dreams of his next getaway, searching travel blogs, Instagram feeds, and reviews for inspiration on possible destinations.
  • I-want-to-go moments: A little later, Max has narrowed his focus to a few places. Now it’s time to compare flights, accommodation, and attractions, taking into account factors such as cost, duration and comfort.
  • I-want-to-do moments: Decision made. His next holiday will be in Ireland. Max is already imagining his getaway to Ireland and planning the experiences he wants to cross off his bucket list. Now, it’s time to turn that dream into a plan.
  • I-want-to-buy moments: As departure time approaches, attention turns to final shopping. Max secures his plane tickets and hotel, and books the long-awaited sea cave kayaking experience in County Wexford. He even buys clothes suitable for the unpredictable Irish weather.

Understanding Max’s micro-moments and his journey opens up countless additional avenues to interact with him in a more meaningful way.  

For example, during the “I-want-to-go moments” phase, sending targeted ads with attractive flight and accommodation offers could capture Max’s attention. Similarly, in the “I-want-to-do moments” phase, showcasing unique local experiences could help him decide. 

Learnings from the travel and leisure industry

Few industries exemplify the power of micro-moments as well as travel and leisure. It’s no coincidence that this sector is frequently cited as an excellent example of how to take advantage of these opportunities.

In travel, the journey from daydreaming to departure spans months, weaving together numerous planning stages, from choosing a destination and accommodation to travel logistics. 

Throughout this extensive decision-making process, users consume content voraciously; in fact, data from 2023 shows that, on average, a traveller browses 141 pages of travel-related content in the 45 days prior to booking.

This figure staggeringly doubles to 277 pages for US-based travellers. This staggering volume of page views is evidence of the curiosity and thoroughness with which today’s travellers approach their planning. 

Furthermore, when analysing the methods used by these travellers to plan their trips, a remarkable 42% rely on random internet searches. This is not just a number, but an indication of the customer psyche, which points to a high, albeit dispersed, demand for relevant, engaging and timely content. 

The application of micro-moments in the tourism and leisure industry is not only widespread, but is arguably where it has the most impact. A compelling example of this strategy in action is Oracle’s collaboration with Disneyland Paris. Using contextual intelligence, they created ads that not only reached the audience, but resonated with them by appearing in the right context at the right time. 

Oracle Advertising used contextual solutions in both display and video campaigns. This resulted in a 250% reduction in the cost per acquisition of display ads and a remarkable doubling of conversions.

This success case demonstrates not only the power of being present at the right micro-moments. For travel and leisure companies, and indeed for all industries, this is a crucial lesson.

The path to capturing a micro-moment starts with understanding the complex multi-device, multidimensional customer journey. It’s also about crafting content and strategies that are not merely visible, but meaningfully integrated into customers’ lives and preferences.

Best practices to start with micro-moments

Before we dive into best practices, it’s worth mentioning that if you’re new to micro-moments, there are fantastic resources available that can illuminate this concept from the very basics. We won’t cover the basics here, but check out this article which I highly recommend. It offers a complete guide on how to get started with micro-moments and integrate them into the customer journey.

Now, let’s explore some of the best practices to effectively engage with your users through micro-moments.

Combine qualitative and quantitative methods to uncover micro-moments

Understanding your audience needs and behaviours is critical to effectively leverage micro-moments. This requires a combination of qualitative and quantitative research methods.

Dive deep into the data to decipher the what and why of your audience search motivations. In addition, qualitative methodologies, such as in-depth interviews and focus groups, are invaluable in adding context and depth to the numbers. 

Focus on bite-sized content

Use bite-sized content such as short videos, infographics and quick, practical tips. The key is to create content that is not only clear, concise and visually appealing, but also respects the consumer’s time. Be creative by reusing existing content or creating new pieces tailored to these micro-moments.

Create a multichannel micro-moments strategy

Users expect a fluid narrative throughout their digital journey, regardless of whether they start their search on one device and then switch to another. To meet this expectation, a multichannel strategy for your micro-moments is crucial. 

Leverage new tools and technologies

New technologies and tools can help you power your micro-moments strategy.  Some of the most interesting ones are:

  • Contextual targeting: Place ads in the right context so that they appear alongside relevant content. Tools such as Google AdSense and Oracle Advertising make this task easier and increase the chances of attracting attention at critical micro-moments.
  • Location-based marketing: Geo-targeting can turn “I-want-to-go moments” moments into opportunities. By targeting ads to users near your business, you not only invite spontaneous visits, but can also increase conversions with timely, localized promotions.
  • Retargeting: Don’t let initial interest fade. Use retargeting to keep your brand in users’ minds and guide them back with the allure of what initially caught their attention.
  • AI-powered customer service tools: AI can provide instant assistance, personalized and predictive responses based on user behaviour. 

Final thoughts

Delving deeper into the customer journey through micro-moments undoubtedly brings us closer to our users.  When we combine this approach with the aforementioned tools and technologies, we unlock a new avenue for interacting with our audiences that allows us to create experiences that connect directly with their immediate needs. 

Yet, as I add the finishing touches to this article, a scene from Jean-Pierre Jeunet’s film “Big Bug” (2022) comes to mind. In it, digital advertisements appear in the windows of people’s homes, telling them in a very loud voice what they apparently need. 

This image sticks with me, as a warning that the essence of our efforts must always focus on understanding and respecting our users. Deep empathy will ensure that we do not cross the fine line between helpfulness and intrusion

Adopting a micro-moment lens is enriching and complex. It is a mix of creativity, understanding and analytical skills. My exploration, particularly in the tourism and leisure industry, demonstrates its enormous potential. It is about more than increasing engagement or conversion rates. It’s about creating deeper and longer lasting bonds with our audience.

The post The power of micro-moments in product marketing appeared first on ProdSens.live.

]]>
https://prodsens.live/2024/06/03/micro-moments-in-product-marketing/feed/ 0