Questions tagged [normalize]

This tag has no single, established meaning at this time. In practice, it is currently being used for a number of unrelated topics. They include normalizing text, vector normalization and normalize() functions in assorted languages. For database normalization, please use [database-normalization].

There is a discussion about the meaning/usage of this tag on Meta Stack Overflow here.

Recent questions using (as of the original writing of this wiki) are on topics including, but not limited to,

  • normalizing text
  • vector normalization
  • functions named normalize()
  • converting various data from multiple incoming ranges to a standard scale
  • normal forms in databases, sometimes in conjunction with
564 questions
460
votes
24 answers

Normalize columns of a dataframe

I have a dataframe in pandas where each column has different value range. For example: df: A B C 1000 10 0.5 765 5 0.35 800 7 0.09 Any idea how I can normalize the columns of this dataframe where each value is between 0 and 1? My…
ahajib
  • 12,838
  • 29
  • 79
  • 120
89
votes
1 answer

Should I use normalize.css in my Bootstrap project?

I can't figure out if I need to add the normalize.css stylesheet in my bootstrap project. I'm using the latest version of bootstrap, v2.3.2.
Omer Raja
  • 1,077
  • 2
  • 9
  • 10
75
votes
9 answers

How can I normalize a URL in python

I'd like to know do I normalize a URL in python. For example, If I have a url string like : "http://www.example.com/foo goo/bar.html" I need a library in python that will transform the extra space (or any other non normalized character) to a proper…
Tom Feiner
  • 20,656
  • 20
  • 48
  • 51
67
votes
4 answers

Why Pytorch officially use mean=[0.485, 0.456, 0.406] and std=[0.229, 0.224, 0.225] to normalize images?

In this page (https://pytorch.org/vision/stable/models.html), it says that "All pre-trained models expect input images normalized in the same way, i.e. mini-batches of 3-channel RGB images of shape (3 x H x W), where H and W are expected to be at…
laridzhang
  • 1,531
  • 3
  • 11
  • 16
63
votes
2 answers

Normalize numpy array columns in python

I have a numpy array where each cell of a specific row represents a value for a feature. I store all of them in an 100*4 matrix. A B C 1000 10 0.5 765 5 0.35 800 7 0.09 Any idea how I can normalize rows of this numpy.array where…
ahajib
  • 12,838
  • 29
  • 79
  • 120
47
votes
2 answers

How can I draw a log-normalized imshow plot with a colorbar representing the raw data in matplotlib

I'm using matplotlib to plot log-normalized images but I would like the original raw image data to be represented in the colorbar rather than the [0-1] interval. I get the feeling there's a more matplotlib'y way of doing this by using some sort of…
Adam Fraser
  • 6,255
  • 10
  • 42
  • 54
32
votes
5 answers

processing strings of text for neural network input

I understand that ANN input must be normalized, standardized, etc. Leaving the peculiarities and models of various ANN's aside, how can I preprocess UTF-8 encoded text within the range of {0,1} or alternatively between the range {-1,1} before it is…
Ælex
  • 14,432
  • 20
  • 88
  • 129
27
votes
6 answers

Normalizing from [0.5 - 1] to [0 - 1]

I'm kind of stuck here, I guess it's a bit of a brain teaser. If I have numbers in the range between 0.5 to 1 how can I normalize it to be between 0 to 1? Thanks for any help, maybe I'm just a bit slow since I've been working for the past 24 hours…
meds
  • 21,699
  • 37
  • 163
  • 314
18
votes
4 answers

Can .NET convert Unicode to ASCII to remove "smart quotes", etc?

Some of our users use e-mail clients that can't cope with Unicode, even when the encoding, etc. are properly set in the mail headers. I'd like to 'normalise' the content they're receiving. The biggest problem we have is users copy'n'pasting content…
Dylan Beattie
  • 53,688
  • 35
  • 128
  • 197
18
votes
8 answers

Inverse of Pandas json_normalize

I just discovered the json_normalize function which works great in taking a JSON object and giving me a pandas Dataframe. Now I want the reverse operation which takes that same Dataframe and gives me a json (or json-like dictionary which I can…
Parsa T
  • 411
  • 3
  • 9
16
votes
3 answers

Is it better to send normalized or denormalized API response back for React+Redux applications

I'm writing a react-redux application. At the beginning it calls a single endpoint, which returns a good amount of data as a heavily nested JSON. I then normalize it and put it into my redux-orm schema. To me it seems silly to create the nested…
NateW
  • 2,856
  • 5
  • 26
  • 46
12
votes
3 answers

Android: sqlite: cursor: getColumnIndex

I've got a fairly complicated query (multiple joins) on a normalized sqlite database. The query does a SELECT * to enable some automated attribute selection logic (so I can't eliminate the "*") The problem I am having is that my result set contains…
celoftis
  • 363
  • 3
  • 6
  • 18
12
votes
4 answers

What does normalizePort() function do in Nodejs?

I was going through this answer then I saw this line of code: var port = normalizePort(process.env.PORT || '4300'); Why not var port = (process.env.PORT || '4300'); From this blog there is an explanation that: The normalizePort(val) function…
YulePale
  • 6,688
  • 16
  • 46
  • 95
12
votes
5 answers

PHP: normalize path of not existing directories to prevent directory traversals?

I would like to normalize a path from an external resource to prevent directory traversal attacks. I know about the realpath() function, but sadly this function returns only the path of existing directories. So if the directory doesn't exist (yet)…
JepZ
  • 1,159
  • 14
  • 27
11
votes
1 answer

Replace Multiple Spaces and Newlines with only one space in PHP

I have a string with multiple newlines. The String: This is a dummy text. I need to format this. Desired Output: This is a dummy text. I need to format this. I'm using…
Sukanta Paul
  • 784
  • 3
  • 19
  • 36
1
2 3
37 38