Skip to content

Commit

Permalink
removed default directory -> SPHINX_DIRECTORY
Browse files Browse the repository at this point in the history
  • Loading branch information
mail4umar committed Oct 25, 2024
1 parent 6f9611b commit db9eedb
Show file tree
Hide file tree
Showing 43 changed files with 1,001 additions and 1,001 deletions.
50 changes: 25 additions & 25 deletions docs/source/examples_business_base_station.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Let's load the two datasets.
from verticapy.datasets import load_world
matplotlib.rcParams['animation.embed_limit'] = 2 ** 128
cdr = vp.read_csv(
"/project/data/VerticaPy/docs/source/_static/website/examples/data/base_station/shanghai_cdr.csv",
"SPHINX_DIRECTORY/source/_static/website/examples/data/base_station/shanghai_cdr.csv",
schema = "shanghai",
table_name = "cdr",
sep = ",",
Expand All @@ -117,7 +117,7 @@ Let's load the two datasets.
# Unique Row id: It will be used to compute the Polygons intersection
cdr["row_id"] = "ROW_NUMBER() OVER(ORDER BY user_id, start_time)"
shanghai_districts = vp.read_csv(
"/project/data/VerticaPy/docs/source/_static/website/examples/data/base_station/shanghai_districts.csv",
"SPHINX_DIRECTORY/source/_static/website/examples/data/base_station/shanghai_districts.csv",
schema = "shanghai",
table_name = "districts",
sep = ",",
Expand All @@ -142,13 +142,13 @@ These datasets contain the following:
:suppress:
res = cdr.head(100)
html_file = open("/project/data/VerticaPy/docs/figures/examples_base_station_cdr_head.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_base_station_cdr_head.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_base_station_cdr_head.html
:file: SPHINX_DIRECTORY/figures/examples_base_station_cdr_head.html

.. code-block:: python
Expand All @@ -158,13 +158,13 @@ These datasets contain the following:
:suppress:
res = shanghai_districts.head(100)
html_file = open("/project/data/VerticaPy/docs/figures/examples_base_station_shanghai_district_head.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_base_station_shanghai_district_head.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_base_station_shanghai_district_head.html
:file: SPHINX_DIRECTORY/figures/examples_base_station_shanghai_district_head.html

Data Exploration
----------------
Expand Down Expand Up @@ -313,7 +313,7 @@ Let's examine the network activity of each of our districts. To do this, we need
y = "latitude",
)
res = intersect_districts_cdr.head(100)
html_file = open("/project/data/VerticaPy/docs/figures/examples_base_station_shanghai_district_activity.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_base_station_shanghai_district_activity.html", "w")
html_file.write(res._repr_html_())
html_file.close()
Expand Down Expand Up @@ -392,7 +392,7 @@ Let's examine the network activity of each of our districts. To do this, we need
file.write(fig.__html__())
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_base_station_animated_bar_activity.html
:file: SPHINX_DIRECTORY/figures/examples_base_station_animated_bar_activity.html

Like you might expect, Shanghai's downtown is the most active one for the selected period.

Expand Down Expand Up @@ -435,13 +435,13 @@ We create virtual base stations by grouping existing base stations in 100 cluste
:suppress:
res = model.predict(bs_xy, name = "cluster")
html_file = open("/project/data/VerticaPy/docs/figures/examples_base_station_model_rediction.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_base_station_model_rediction.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_base_station_model_rediction.html
:file: SPHINX_DIRECTORY/figures/examples_base_station_model_rediction.html


.. ipython:: python
Expand All @@ -460,10 +460,10 @@ We create virtual base stations by grouping existing base stations in 100 cluste
vp.set_option("plotting_lib","plotly")
fig = model.plot_voronoi(plot_crosses = False)
fig.write_html("/project/data/VerticaPy/docs/figures/examples_base_station_voronoi_plotly.html")
fig.write_html("SPHINX_DIRECTORY/figures/examples_base_station_voronoi_plotly.html")
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_base_station_voronoi_plotly.html
:file: SPHINX_DIRECTORY/figures/examples_base_station_voronoi_plotly.html


In this figure, each Voronoi cell represents a base station cluster.
Expand Down Expand Up @@ -525,13 +525,13 @@ Workload is defined as the number of connections per time interval. To find the
:suppress:
res = cdr_sample.head(100)
html_file = open("/project/data/VerticaPy/docs/figures/examples_base_station_cdr_sample_head.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_base_station_cdr_sample_head.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_base_station_cdr_sample_head.html
:file: SPHINX_DIRECTORY/figures/examples_base_station_cdr_sample_head.html



Expand Down Expand Up @@ -589,7 +589,7 @@ Workload is defined as the number of connections per time interval. To find the
file.write(fig.__html__())
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_base_station_animated_scatter_longi.html
:file: SPHINX_DIRECTORY/figures/examples_base_station_animated_scatter_longi.html

From the above animation, we can see that we'll typically have unconnected base stations and that the most overloaded base stations are located around the downtown.

Expand Down Expand Up @@ -622,12 +622,12 @@ We can then calculate the workload for each cluster.
:suppress:
res = bs_workload_90
html_file = open("/project/data/VerticaPy/docs/figures/examples_base_station_bs_workload_90.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_base_station_bs_workload_90.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_base_station_bs_workload_90.html
:file: SPHINX_DIRECTORY/figures/examples_base_station_bs_workload_90.html

.. ipython:: python
Expand Down Expand Up @@ -663,12 +663,12 @@ We can then calculate the workload for each cluster.
:suppress:
res = cworkload_bs
html_file = open("/project/data/VerticaPy/docs/figures/examples_base_station_cworkload_bs.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_base_station_cworkload_bs.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_base_station_cworkload_bs.html
:file: SPHINX_DIRECTORY/figures/examples_base_station_cworkload_bs.html

Data Modeling
--------------
Expand Down Expand Up @@ -720,10 +720,10 @@ Let's find a suitable number of clusters using elbow curve.
from verticapy.machine_learning.model_selection import elbow
vp.set_option("plotting_lib", "plotly")
fig = elbow(bs_xy, ["longitude", "latitude"])
fig.write_html("/project/data/VerticaPy/docs/figures/examples_base_station_elbow_longi_lati.html")
fig.write_html("SPHINX_DIRECTORY/figures/examples_base_station_elbow_longi_lati.html")
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_base_station_elbow_longi_lati.html
:file: SPHINX_DIRECTORY/figures/examples_base_station_elbow_longi_lati.html

The :py:func:`~verticapy.machine_learning.model_selection.elbow` curve seems to indicate that 4 would be a good number of clusters, so let's try k = 4 and view the weighted ``k-means`` algorithm's suggested positions for new base stations based on the centers of the clusters.

Expand Down Expand Up @@ -813,13 +813,13 @@ The features used to train our model will be longitude, latitude, total number o
:suppress:
res = bs_metrics
html_file = open("/project/data/VerticaPy/docs/figures/examples_base_station_bs_metrics.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_base_station_bs_metrics.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_base_station_bs_metrics.html
:file: SPHINX_DIRECTORY/figures/examples_base_station_bs_metrics.html


.. ipython:: python
Expand Down Expand Up @@ -862,10 +862,10 @@ The features used to train our model will be longitude, latitude, total number o
vp.set_option("plotting_lib","plotly")
fig = model.plot()
fig.write_html("/project/data/VerticaPy/docs/figures/examples_base_station_auto_ml_plot.html")
fig.write_html("SPHINX_DIRECTORY/figures/examples_base_station_auto_ml_plot.html")
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_base_station_auto_ml_plot.html
:file: SPHINX_DIRECTORY/figures/examples_base_station_auto_ml_plot.html

Conclusion
-----------
Expand Down
54 changes: 27 additions & 27 deletions docs/source/examples_business_battery.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ Let's examine our data. Here, we use :py:func:`~verticapy.vDataFrame.head` to re
.. ipython:: python
:suppress:
battery5 = vp.read_csv("/project/data/VerticaPy/docs/source/_static/website/examples/data/battery/data.csv",)
battery5 = vp.read_csv("SPHINX_DIRECTORY/source/_static/website/examples/data/battery/data.csv",)
res = battery5
html_file = open("/project/data/VerticaPy/docs/figures/examples_battery_table_head.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_battery_table_head.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_battery_table_head.html
:file: SPHINX_DIRECTORY/figures/examples_battery_table_head.html

Let's perform a few aggregations with :py:func:`~verticapy.vDataFrame.describe` to get a high-level overview of the dataset.

Expand All @@ -101,12 +101,12 @@ Let's perform a few aggregations with :py:func:`~verticapy.vDataFrame.describe`
:suppress:
res = battery5.describe()
html_file = open("/project/data/VerticaPy/docs/figures/examples_battery_table_describe.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_battery_table_describe.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_battery_table_describe.html
:file: SPHINX_DIRECTORY/figures/examples_battery_table_describe.html

To get a better idea of the changes between each cycle, we look at an aggregation at their start time, duration, and voltage at the beginning and the end of each cycle.

Expand All @@ -118,12 +118,12 @@ To get a better idea of the changes between each cycle, we look at an aggregatio
:suppress:
res = battery5["start_time"].describe()
html_file = open("/project/data/VerticaPy/docs/figures/examples_battery__start_time_table_describe.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_battery__start_time_table_describe.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_battery__start_time_table_describe.html
:file: SPHINX_DIRECTORY/figures/examples_battery__start_time_table_describe.html

To see how the voltage changes during the cycle, we extract the initial and final voltage measurements for each cycle.

Expand Down Expand Up @@ -189,12 +189,12 @@ To see how the voltage changes during the cycle, we extract the initial and fina
).sort("start_time")
cycling_info["cycle_id"] = "ROW_NUMBER() OVER(ORDER BY start_time)"
res = cycling_info.head(100)
html_file = open("/project/data/VerticaPy/docs/figures/examples_battery_cycling_info.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_battery_cycling_info.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_battery_cycling_info.html
:file: SPHINX_DIRECTORY/figures/examples_battery_cycling_info.html

We can see from the "duration" column that charging seems to take a longer time than discharging.
Let's visualize this trend with an animated graph.
Expand All @@ -213,12 +213,12 @@ Let's visualize this trend with an animated graph.
import warnings
warnings.filterwarnings("ignore")
res = cycling_info.animated_bar(ts = "start_time",columns = ["type", "cycle_duration"])
html_file = open("/project/data/VerticaPy/docs/figures/examples_battery_animated_bar.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_battery_animated_bar.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_battery_animated_bar.html
:file: SPHINX_DIRECTORY/figures/examples_battery_animated_bar.html

The animated graph below shows how the cycles change throughout time. Another way we can verify that charging cycles are longer than discharging cycles is by looking at the average duration of each type of cycle.

Expand All @@ -236,10 +236,10 @@ The animated graph below shows how the cycles change throughout time. Another wa
import verticapy
verticapy.set_option("plotting_lib", "plotly")
fig = cycling_info.bar(["type"], method = "avg", of = "cycle_duration")
fig.write_html("/project/data/VerticaPy/docs/figures/examples_battery_bar_type.html")
fig.write_html("SPHINX_DIRECTORY/figures/examples_battery_bar_type.html")
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_battery_bar_type.html
:file: SPHINX_DIRECTORY/figures/examples_battery_bar_type.html

In general, charging cycles are longer than discharging cycles.
Let's examine how voltage changes between cycles and their transitions.
Expand Down Expand Up @@ -275,12 +275,12 @@ Let's examine how voltage changes between cycles and their transitions.
],
)
res = cycling_info.head(100)
html_file = open("/project/data/VerticaPy/docs/figures/examples_battery_cycling_info_after_groupby.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_battery_cycling_info_after_groupby.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_battery_cycling_info_after_groupby.html
:file: SPHINX_DIRECTORY/figures/examples_battery_cycling_info_after_groupby.html

From this table, it looks like batteries are charged until they are almost full (4.2V) and discharging doesn't begin until they are fully charged.

Expand Down Expand Up @@ -315,12 +315,12 @@ But first we need to perform some preprocessing.
window = (-100, -1),
name = "smooth_capacity",
)
html_file = open("/project/data/VerticaPy/docs/figures/examples_battery_cycling_info_after_rollign_2.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_battery_cycling_info_after_rollign_2.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_battery_cycling_info_after_rollign_2.html
:file: SPHINX_DIRECTORY/figures/examples_battery_cycling_info_after_rollign_2.html

Now we can plot the graphs. In VerticaPy we have multiple options to plot the graphs with different syntax of customization. For a complete list of all the graphs and their options check out the :ref:`chart_gallery`.

Expand Down Expand Up @@ -389,10 +389,10 @@ We can now try to plot it using Plotly. We can conveniently switch between the p
# Add legend for the horizontal line
plot.add_trace(go.Scatter(x = [None], y = [None], mode = "lines", line = dict(color="green", width=3, dash="dash"), name = "End-of-life criteria"))
fig = plot
fig.write_html("/project/data/VerticaPy/docs/figures/examples_battery_discharge_plotly_plote.html")
fig.write_html("SPHINX_DIRECTORY/figures/examples_battery_discharge_plotly_plote.html")
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_battery_discharge_plotly_plote.html
:file: SPHINX_DIRECTORY/figures/examples_battery_discharge_plotly_plote.html

The sudden increases in battery capacity come from the self-charging property of Li-ion batteries. The smoothed graph makes
the downward trend in the battery's capacity very clear.
Expand Down Expand Up @@ -465,10 +465,10 @@ Since measurements like voltage and temperature tend to differ within the differ
sample_cycle = battery5[battery5["Capacity"] == "1.83514614292266"]
sample_cycle["Voltage_measured"].plot(ts = "Time")
fig = sample_cycle["Temperature_measured"].plot(ts = "Time")
fig.write_html("/project/data/VerticaPy/docs/figures/examples_battery_temp_plot.html")
fig.write_html("SPHINX_DIRECTORY/figures/examples_battery_temp_plot.html")
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_battery_temp_plot.html
:file: SPHINX_DIRECTORY/figures/examples_battery_temp_plot.html

We'll define new features that describe the minimum and maximum temperature during one cycle; the minimal voltage; and the time needed to reach minimum voltage and maximum temperature.

Expand Down Expand Up @@ -657,10 +657,10 @@ We can visualize the performance and efficency differences of each model with a
:okwarning:
fig = model.plot()
fig.write_html("/project/data/VerticaPy/docs/figures/examples_battery_auto_ml_plot.html")
fig.write_html("SPHINX_DIRECTORY/figures/examples_battery_auto_ml_plot.html")
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_battery_auto_ml_plot.html
:file: SPHINX_DIRECTORY/figures/examples_battery_auto_ml_plot.html

.. ipython:: python
Expand Down Expand Up @@ -721,12 +721,12 @@ We can now define the model using those hyperparameters and train it.
:suppress:
res = model_rf.regression_report()
html_file = open("/project/data/VerticaPy/docs/figures/examples_battery_reg_reprot.html", "w")
html_file = open("SPHINX_DIRECTORY/figures/examples_battery_reg_reprot.html", "w")
html_file.write(res._repr_html_())
html_file.close()
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_battery_reg_reprot.html
:file: SPHINX_DIRECTORY/figures/examples_battery_reg_reprot.html

The predictive power of our model looks pretty good. Let's use our model to predict the SoH of the battery. We can visualize our prediction with a plot against the true values.

Expand Down Expand Up @@ -754,10 +754,10 @@ The predictive power of our model looks pretty good. Let's use our model to pred
ts = "start_time",
columns = ["SOH", "SOH_estimates"],
)
fig.write_html("/project/data/VerticaPy/docs/figures/examples_battery_auto_ml_plot.html")
fig.write_html("SPHINX_DIRECTORY/figures/examples_battery_auto_ml_plot.html")
.. raw:: html
:file: /project/data/VerticaPy/docs/figures/examples_battery_auto_ml_plot.html
:file: SPHINX_DIRECTORY/figures/examples_battery_auto_ml_plot.html

Conclusion
-----------
Expand Down
Loading

0 comments on commit db9eedb

Please sign in to comment.