Enter the experiment.
I made a decision over the weekend to present not inform. I needed Skip to expertise the brand new expertise for himself — not simply hear me speak about it. What if we might make a marketing strategy to launch a hypothetical new farm in beneath 40 minutes? I might do it utilizing a ChatGPT 4 with the Superior Information Evaluation enabled, over display screen share to his iPhone — we’d collaborate collectively to construct it.
We briefly mentioned our assumptions:
- Now we have 1,000 acres to farm in East Texas
- Now we have $1M in begin up capital to buy gear with
- We have to safe a line of credit score from a financial institution on 12 months 1 working expense to get began
- We’re concerned about rising Wheat and Soybeans (what Skip truly farmed again within the day)
We began easy:
Immediate 1: “Write me an overview for a marketing strategy to begin a brand new farm in East Texas to develop wheat and soybeans”.
Skip was instantly impressed with the lengthy type outcomes. However wait, we had been simply getting began…
Immediate 2: “Give me an inventory of kit I must get began”
Immediate 3: “Put it in a desk and prioritize numerically primarily based on what’s most urgently wanted to least pressing”
Immediate 4: “now create a brand new column for price range allocation, Assume I’m going use a mix of leases and purchases, create a further column to suggest lease vs buy, assume I’ve $1M in beginning capital.”
(Time elapsed 4 minutes)
Consequence:
Immediate 5: “How a lot ought to I put aside to ask for a line of credit score for variable value (seed, fertilizer, labor, and many others.), assume 1000 acres. Create a brand new desk.”
Consequence:
By this level, I felt like Skip has simply witnessed Apollo 11 over again. He might barely comprise his pleasure. However we nonetheless weren’t achieved…
Immediate 6: “Write me a Monte Carlo simulation that I can alter my enter assumptions and check the end result on my my price range”
Outcomes:
import numpy as np
import matplotlib.pyplot as plt# Outline variety of simulations
n_simulations = 10000
# Assumptions with [mean, std deviation]
wheat_seed_cost = [20, 2] # Value per acre
soybean_seed_cost = [50, 5]
fertilizer_wheat_cost = [50, 5]
fertilizer_soybean_cost = [40, 4]
labor_cost = [25, 3]
pesticide_cost = [30, 3]
fuel_maintenance_cost = [15, 2]
miscellaneous_cost = [10, 1]
def simulate_farm_costs():
wheat_seed = np.random.regular(wheat_seed_cost[0], wheat_seed_cost[1])
soybean_seed = np.random.regular(soybean_seed_cost[0], soybean_seed_cost[1])
fertilizer_wheat = np.random.regular(fertilizer_wheat_cost[0], fertilizer_wheat_cost[1])
fertilizer_soybean = np.random.regular(fertilizer_soybean_cost[0], fertilizer_soybean_cost[1])
labor = np.random.regular(labor_cost[0], labor_cost[1])
pesticide = np.random.regular(pesticide_cost[0], pesticide_cost[1])
fuel_maintenance = np.random.regular(fuel_maintenance_cost[0], fuel_maintenance_cost[1])
miscellaneous = np.random.regular(miscellaneous_cost[0], miscellaneous_cost[1])
total_cost = (wheat_seed + soybean_seed + fertilizer_wheat + fertilizer_soybean +
labor + pesticide + fuel_maintenance + miscellaneous) * 1000 # for 1000 acres
return total_cost
outcomes = [simulate_farm_costs() for _ in range(n_simulations)]
# Visualization
plt.hist(outcomes, bins=50, edgecolor='black', alpha=0.7)
plt.title('Distribution of Whole Farm Prices')
plt.xlabel('Whole Value')
plt.ylabel('Frequency')
plt.grid(True, alpha=0.2)
plt.present()
Now for the second of reality — will the code run? We hopped over to Jupyter pocket book to run the code. And there it’s on the primary strive:
By this level, we had been solely 10–quarter-hour in. Nonetheless have a while to spare…May we make it interactive?
We have to create an inventory of parameters that permit for the consumer to dynamically alter the assumptions on a slider. Once more we flip the ChatGPT for some suggestions of what these parameters have to be primarily based on the Monte Carlo we constructed earlier:
As soon as we have now our record of parameters constructed, we create a ‘measures’ desk in Energy BI tied to 16 slicer visuals that permit the consumer to manually choose their inputs and dynamically replace the Monte Carlo simulation. To do that we create a ‘Python Visible’ in Energy BI, drag all of our measures in, after which replace the code as follows:
# The next code to create a dataframe and take away duplicated rows is at all times executed and acts as a preamble to your script: # dataset = pandas.DataFrame(fertilizer_soybean_cost_avg Worth, fertilizer_soybean_cost_std Worth, fertilizer_wheat_cost_avg Worth, fertilizer_wheat_cost_std Worth, fuel_maintenance_cost_avg Worth, fuel_maintenance_cost_std Worth, labor_cost_avg Worth, labor_cost_std Worth, miscellaneous_cost_avg Worth, miscellaneous_cost_std Worth, pesticide_cost_avg Worth, pesticide_cost_std Worth, soybean_seed_cost_avg Worth, wheat_seed_cost_avg Worth, wheat_seed_cost_std Worth)
# dataset = dataset.drop_duplicates()
# Paste or sort your script code right here:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Assuming the information from Energy BI is handed as 'dataset'
df = dataset
# Fetch values from the dataset
wheat_seed_cost_avg = df['wheat_seed_cost_avg Value'].iloc[0]
wheat_seed_cost_std = df['wheat_seed_cost_std Value'].iloc[0]
soybean_seed_cost_avg = df['soybean_seed_cost_avg Value'].iloc[0]
soybean_seed_cost_std = df['soybean_seed_cost_std Value'].iloc[0]
fertilizer_wheat_cost_avg = df['fertilizer_wheat_cost_avg Value'].iloc[0]
fertilizer_wheat_cost_std = df['fertilizer_wheat_cost_std Value'].iloc[0]
fertilizer_soybean_cost_avg = df['fertilizer_soybean_cost_avg Value'].iloc[0]
fertilizer_soybean_cost_std = df['fertilizer_soybean_cost_std Value'].iloc[0]
labor_cost_avg = df['labor_cost_avg Value'].iloc[0]
labor_cost_std = df['labor_cost_std Value'].iloc[0]
pesticide_cost_avg = df['pesticide_cost_avg Value'].iloc[0]
pesticide_cost_std = df['pesticide_cost_std Value'].iloc[0]
fuel_maintenance_cost_avg = df['fuel_maintenance_cost_avg Value'].iloc[0]
fuel_maintenance_cost_std = df['fuel_maintenance_cost_std Value'].iloc[0]
miscellaneous_cost_avg = df['miscellaneous_cost_avg Value'].iloc[0]
miscellaneous_cost_std = df['miscellaneous_cost_std Value'].iloc[0]
# Outline variety of simulations
n_simulations = 10000
# Assumptions with [mean, std deviation]
wheat_seed_cost = [wheat_seed_cost_avg, wheat_seed_cost_std]
soybean_seed_cost = [soybean_seed_cost_avg, soybean_seed_cost_std]
fertilizer_wheat_cost = [fertilizer_wheat_cost_avg, fertilizer_wheat_cost_std]
fertilizer_soybean_cost = [fertilizer_soybean_cost_avg, fertilizer_soybean_cost_std]
labor_cost = [labor_cost_avg, labor_cost_std]
pesticide_cost = [pesticide_cost_avg, pesticide_cost_std]
fuel_maintenance_cost = [fuel_maintenance_cost_avg, fuel_maintenance_cost_std]
miscellaneous_cost = [miscellaneous_cost_avg, miscellaneous_cost_std]
def simulate_farm_costs():
wheat_seed = np.random.regular(wheat_seed_cost[0], wheat_seed_cost[1])
soybean_seed = np.random.regular(soybean_seed_cost[0], soybean_seed_cost[1])
fertilizer_wheat = np.random.regular(fertilizer_wheat_cost[0], fertilizer_wheat_cost[1])
fertilizer_soybean = np.random.regular(fertilizer_soybean_cost[0], fertilizer_soybean_cost[1])
labor = np.random.regular(labor_cost[0], labor_cost[1])
pesticide = np.random.regular(pesticide_cost[0], pesticide_cost[1])
fuel_maintenance = np.random.regular(fuel_maintenance_cost[0], fuel_maintenance_cost[1])
miscellaneous = np.random.regular(miscellaneous_cost[0], miscellaneous_cost[1])
total_cost = (wheat_seed + soybean_seed + fertilizer_wheat + fertilizer_soybean +
labor + pesticide + fuel_maintenance + miscellaneous) * 1000 # for 1000 acres
return total_cost
outcomes = [simulate_farm_costs() for _ in range(n_simulations)]
# Convert outcomes right into a dataframe
df_simulated_results = pd.DataFrame(outcomes, columns=['Total Cost'])
# Calculate the Interquartile Vary (IQR)
Q1 = df_simulated_results['Total Cost'].quantile(0.25)
Q3 = df_simulated_results['Total Cost'].quantile(0.75)
# Plotting the histogram
plt.determine(figsize=(10, 6))
n, bins, patches = plt.hist(df_simulated_results['Total Cost'], bins=50, shade='blue', edgecolor='black', alpha=0.7)
plt.title('Distribution of 12 months 1 Variable Farm Prices from Simulation')
plt.xlabel('12 months 1 Variable Value')
plt.ylabel('Frequency')
plt.grid(True, which='each', linestyle='--', linewidth=0.5)
# Shade the IQR
for i in vary(len(bins)):
if bins[i] > Q1 and bins[i] < Q3:
patches[i].set_facecolor('inexperienced')
plt.axvline(Q1, shade='purple', linestyle='dashed', linewidth=1)
plt.axvline(Q3, shade='purple', linestyle='dashed', linewidth=1)
plt.tight_layout()
plt.savefig('simulated_costs_histogram.png') # It will save the determine as a picture file
plt.present()
Only for enjoyable, we prompted ChatGPT to outline the Inter-Quartile Vary (IQR) and shade it a unique shade, we additionally manually up to date the chart labels and x-axis. The remainder of simply cleansing up the visuals a bit in Energy BI to make it a bit extra consumer pleasant. The tip outcome:
Now we have now a dynamic Monte Carlo simulation to mess around with completely different enter value assumptions and undertaking out the variable working expense we would wish to get our farming operation off the bottom. Leveraging ChatGPT 4, we wrote just about no code, simply tweaked it a bit, did many of the work from an iPhone over display screen share, constructed the final piece in PBI desktop and display screen shared it over the PBI iPhone app. All in about 30–40 minutes of labor.
My grandfather’s verdict? “We achieved in 40 minutes what would have taken him 2 years to do on his personal ‘again within the day’.” Sure, I acknowledge there’s much more we might do — and it “simulation” is much from excellent. (For instance, we don’t delineate between % of crops dedicated to soybeans vs wheat.) However for 40 minutes? Even I used to be impressed. And that is the promise of Gen AI — democratizing knowledge science, encouraging experimentation, and dashing up the power to develop all inside the palm of your hand. Permitting a grandfather and his grandson a possibility to reconnect over some statistics and leveraging expertise in new and sudden methods.