I’m trying to use Mathematica’s NonlinearModelFit
function to find a best fit for data collected that follows the equationy=aExp(bz)
, where a and b are the fitting parameters, and z is the variable. So I have many measured y values for several z values, but the fit I obtain when using the NonlinearModelFit
is not quite what I expect it to be. From my understanding, the default weight for each data point is equal, and the standard error is calculated using (y_i  y_i,fitted)^2
for every data point. I would like to use the weight 1/(y_i+y_i,fitted)^2
so that each data point is weighted more equally. I understand the use of the example LinearModelFit(Range(10)^2, x, x, Weights > (Sqrt(#2) &)) // Normal
from https://reference.wolfram.com/language/ref/Weights.html where I can incorporate the value of y_i
, but I’m still just not sure how to implement the value y_i,fitted
into the weights, if it is possible. Any help would be appreciated, thanks!
Tag: weight
mysql – How to write a query to get wine pairing for a pizza based on pairing weight
I am working on a query to pair drinks to pizzas.
Currently I am able to show the pizza_name, beverage and the pairing_weight being the amount of toppings on a pizza that the beverage pairs with.
From here, I am looking to just output a mapping of distinct pizza name to beverage.
I am unsure how to format the query to just return the top result per pizza based on pairing_weight.
mysql> select pizza_name, beverage, COUNT(beverage) as pairing_weight
> from pizza_production
> JOIN pizza_restrictions pr on
> pizza_production.topping_name = pr.topping_name
> JOIN beverage_pairing_notes on
> restriction = pairing
> GROUP BY pizza_name, beverage
> ORDER BY pizza_name, pairing_weight DESC;
++++
 pizza_name  beverage  pairing_weight 
++++
 Grand Padano  Prosecco  2 
 Grand Padano  Champagne  2 
 Grand Padano  Riesling  2 
 Grand Padano  Cava  2 
 Grand Padano  Pinot Noir  1 
 Grand Padano  Carlsberg beer  1 
 Grand Padano  Zinfandel Rosé  1 
 Grand Padano  Chardonnay  1 
 Grand Padano  Chenin Blanc  1 
 Grand Padano  Gewürztraminer  1 
 Grand Padano  Guinness beer  1 
 Grand Padano  Pinot Grigio  1 
 Grand Padano  Heineken beer  1 
 Grand Padano  Irn Bru  1 
 Grand Padano  Malbec  1 
 Grand Padano  Muscat Blanc  1 
 new york  Riesling  2 
 new york  Champagne  2 
 new york  Prosecco  2 
 new york  Pinot Noir  2 
 new york  Malbec  2 
 new york  Syrah  1 
 new york  Cava  1 
 new york  Cabernet Sauvignon  1 
 new york  Chardonnay  1 
 new york  Carlsberg beer  1 
 new york  Chenin Blanc  1 
 new york  Gewürztraminer  1 
 new york  Guinness beer  1 
 new york  Muscat Blanc  1 
 new york  Heineken beer  1 
 pepperoni  Pinot Noir  3 
 pepperoni  Malbec  3 
 pepperoni  Muscat Blanc  2 
 pepperoni  Heineken beer  2 
 pepperoni  Guinness beer  2 
 pepperoni  Gewürztraminer  2 
 pepperoni  Chenin Blanc  2 
 pepperoni  Riesling  2 
 pepperoni  Carlsberg beer  2 
 pepperoni  Cabernet Sauvignon  2 
 pepperoni  Chardonnay  1 
 pepperoni  Champagne  1 
 pepperoni  Prosecco  1 
 pepperoni  Cava  1 
 pepperoni  Rioja  1 
 pepperoni  Syrah  1 
 pepperoni  Zinfandel Rosé  1 
 vegetarian  Diet Coke  2 
 vegetarian  Prosecco  1 
 vegetarian  Champagne  1 
 vegetarian  Riesling  1 
++++
52 rows in set (0.01 sec)
An example of desired output would be
+++
 pizza_name  beverage 
+++
 pepperoni  Pinot Noir 
 new york  Riesling 
 Grand Padano  Prosecco 
 vegetarian  Diet Coke 
+++
Is there a way to pull this data from what I already have in the output of the query above?
Thank you.
Weight loss?  Forum Promotion
Empire, that may be a straight forward answer that might be needed, but you also need to take into consideration that not all people are equal in how they metabolize the food they eat. For example, some people are fat due to one health reason or another, that slowed down how fast they burn off what they eat for those people. Simply saying that you got fat, because you didn’t care about stopping yourself from getting fat, isn’t always fact.
Also, not all people get fat, due to being lazy. Infact I know a dairy farmer that does a ton of moving around and such, but was told by a doctor, that his weight he has, was because his body “got used to the level of activity” he put forward for running his business. And believe me, he does a ton of stuff that for a normal person, would burn weight off like crazy.
quantum mechanics – Beam Splitter Toy Model History Weight Calculation
Given this modern of a beam splitter (see picture), and the two possible histories:
Yc = (0a) • (1c) • (2c) • (3c) • (4c)
And
Yd = (0a) • (1d) • (2d) • (3d) • (4d)
for f=4,
how do I calculate the weight of history Yc and Yd. I know Yc=Yd=0.5, but how do I calculate this? I hope I have provided enough information to answer this question. The material comes from Robert Griffiths “Consistent Quantum Theory” pg. 140142.
Thank youbeam splitter toy model
python – Initialize weights in pytorch with customized weight?
I want to initialize the weights of my neural network with parameters samples from a specific distribution, that is not already present in nn.init module. Let’s say for example a beta distribution.
I saw that you can use the method described there: Custom weight initialization in PyTorch
But there you need to use the nn.init. What is an elegant way to initialize weights from a distribution that I specify
algorithms – Sorting n weight disks with decision tree
I was refreshing some old tests about sorting algorithms, there was a question as follow:
Question: we have
n
weight disks with different weights and we want to sort them pair by pair, How many times we have to weight in worst case (maximum comparisons) to sort the whole disks?
the answer was $ lceil logn! rceil $.
My issue is that I could not get to the answer and could anyone elaborate on how the answer is working?
Also one of the options was $ lceil nlogn rceil $, and as we know,
the order of $logn!$ and $nlogn$ are same, So why shouldn’t the
ceilings be equal too?
and How does having an ordered and distinct set of size
n
, matter in decision tree?
algorithms – 0/1 Knapsack problem with minimal weight
so i have this problem where:

I have to accomplish a challenge with n quests. Each quest gives me:
 p points and
 needs t time to be done.

The object is to complete the challenge that needs M points to be completed, in the least possible time.
So let’s say i have these following quests:
q1 => p1=20, n1=5
q2 => p2=40, n2=20
q3 => p3=10, n3=2
q4 => p4=30, n4=6
I want to solve this problem for M = 50.
I could solve q2 and q3 in time 22. I will get the 50 points, but it’s not the optimal solution since solving q1 and q4 will also give me 50 points in time 11.
I know that this is a knapsack problem but i just can’t figure out how i am suppose to store in my table so i can get a result the set of quests that have to be done in order to have the least possible time. I need to find a dynamic programming algorithm which will be able to find the answer. If someone knows how my data structure should look like and how i should store the data inside, generally what idea should i follow in order to solve this problem, i would really appreciate help since i’ve been stuck and i don’t know how to solve it.
Command for finding maximum weight Hamiltonian path between two vertices
A Hamiltonian path is a graph path between two vertices of a graph that visits each vertex exactly once.
Finding a single Hamiltonian path of a graph $g$ is implemented in the Wolfram Language as FindHamiltonianPath[$g$]Hamiltonian path.
What command could be used to find the Hamiltonian path with maximum path weight between the starting vertex $s$ and the terminating vertex $t$ in the following edge labeled graph?
8 – Shipping weight not calculated?
we are currently trying to get our drupal commerce 2 attaching a certain shipping method based on the weight of the order. It is pretty simple (at least I thought so): if the order is below 20kg, it is one rate, above a second rate.
Here is what I did:
 enabled commerce shipping module and physical fields
 added a custom physical weight field field_prod_gewicht to the default product type (the only one we have)
 marked the default product variation as shippable
 filled the individual products with their weights accordingly
 created two shipping methods with different prices, only restricted by Shippment Weight
So far so good – on the shipping page I see indeed only the lower rate shipping method, but if i adde more weight to the order, the higher rate shipping method never appears.
My suspicion is, that the weight is not calculated at all, or that there is some kind of implicit convention I did not follow.
Anybody has an idea, how to solve or debug this?
Thx a lot!
air travel – If a flight ticket indicates that the maximum luggage weight is “50 lb/23kg”, is the limit 50lb or 23kg?
23kg = 50.7 lb. I know that typically the checkin counter agents would allow checkin luggage to be above 1 lb the maximum free authorized weight, but just in case some agent decides to strictly apply the luggage weight policy.
If specific to the airline, I’m currently interested in Qatar Airways. If specific to the departure airport, I’m currently interested in SFO.