Category Archives: Computers

Quantum Cross Validation

So here is why chatGPT is so disruptive.

You can basically ask it advanced scientific questions about concepts you don’t fully grasp but you know how the technology has been used in certain areas. Case in point, quantum cross validation.

I figured I know about IBM’s qiskit, and I know about quantum cross validation, but I’ve never used qiskit and unsure how I would setup the problem.

So… I asked chatGPT my understanding of the problem,

Then I recalled the bright idea to refine the prompt questions based on a feedback loop by volleying back inferences into chatGPT (essentially iterating over the inference system) asking it to rephrase–providing clarity where necessary–and to make any suggested scientific corrections (important: upped the “top p” to ensure it was using more resources to get a quality answer). Then I fed this refined question back into chatGPT until “is the above information accurate, clarify where it’s not” was answered as “True”, and there was nothing left to clarify and then I finally took away what it coded me.

I have yet to test this as I’m still working towards finetuning my own GPT-Neo, but this is what I’ve been hoping people understand about these system’s. They have generalized on the relationships in language to basically query up these results for us. The more data you have exposure to, the more relationships derived the wider the set of questions the system can respond to.

https://gist.github.com/thistleknot/466d6abbb85638de1d1552aab6984bf5

Turing GAN

I was thinking about how GAN’s have been used to create real life looking images and thought… we have chatbot’s that sound realistic enough (chatGPT). Couldn’t GAN’s be used to develop a conversation system (chatbot for lack of better word) that was validated by a GAN in much the same way as GAN’s are used to generate realistic images? The engine would just keep correcting itself until it passed the GAN’s thresholds.

#turing

The concept of Hell

Human: Is the idea of hell a scare tactic? Where did it come from if Jewish people don’t hold a similar belief? How did the idea evolve from a Jewish religion to existing within a Christian one if Christianity inherited their ideas from Judaism before writing their own new testament on top of the Old Testament? What specific books of the bible, authors, even verses were construed to support the idea of hell and highlight whether it was a judaic source or christian (new testament).
AI:
The concept of hell as a place of punishment after death is not believed in by Jews, as they do not take a belief in an afterlife. However, the concept of hell does exist in Christianity and has evolved from its Judaic roots. The idea of Hell as a place of punishment for sin was first present in the religion of Zoroastrianism and was adopted by Judaism and then Christianity, with the earliest references to Hell being found in the Jewish Apocrypha.

The New Testament mentions the concept of Hell several times, including in Matthew 25:46, Revelation 21:8, and 2 Peter 2:4. Many theologians believe that the Christian concept of Hell was influenced heavily by the Jewish concept of Gehenna, which was a place outside of Jerusalem where sacrifices were made. Additionally, several Old Testament passages refer to a place of punishment, including Isaiah 66:24 and Psalm 9:17.

chatGPT – Ice Age, Flood, and Atlantis

How is it that humans for thousands of years survived the Ice Age? Was the whole world covered in ice? If not were there warm/habitable regions that would have allowed for agricultural farming? What is the likelihood that civilizations sprang up in these areas and when the ice melted they were lost under the incoming water? What is more likely. That humans were hunter gatherer’s during this entire time, or that they developed basic agricultural skills. Please defend your case with examples.
AI:

Humans survived the Ice Age primarily through a combination of hunter-gatherer and, to some degree, agricultural practices. Hunter-gatherer activities such as fishing, hunting, gathering, and scavenging provided a steady and reliable source of sustenance across the entirety of the Ice Age. It is also likely that humans developed some basic agricultural skills during this time period, especially in areas with warmer climates that were not covered in ice. For example, evidence suggests that humans living in what is now the United Kingdom during the Ice Age practiced cereal cultivation on a small scale.

In regards to civilizations potentially springing up in areas with warm climates and then being lost when the ice melted, this is unlikely. While it is possible that such civilizations once existed, the archaeological record does not provide any evidence to suggest that this actually happened. Moreover, due to the migratory nature of humans living during the Ice Age, it is more likely that any civilizations that did form would have been widely dispersed rather than concentrated in one particular area.
Human: So… your take is the Atlantis story as described by Plato being handed down by the Egyptians doesn’t describe what exists in multiple world religions (a deluge) when the straights of Gibraltar broke and created the Mediterranean?
AI:

No, I do not believe that the Atlantis story as described by Plato is related to the flood described in multiple world religions. While Plato’s story features a large flood, it is likely an exaggeration of a much smaller event or event series that occurred in the region. Additionally, archaeological evidence does not support the idea that these two floods are related in any way.
Human: What does the archeological evidence say about these two floods then?
AI:
The archaeological evidence indicates that the floods described in multiple world religions likely occurred thousands of years before the events described in Plato’s story. Furthermore, the scale of the floods described in world religions is significantly larger and more destructive than the flood described in Plato’s story. This suggests that the two floods are likely not related.
Human: How do we have any basis to know the timeframes of when the two floods might have occurred?
AI:

We know that the floods described in multiple world religions occurred prior to the events described in Plato’s story thanks to a variety of archaeological evidence. For example, historians and archaeologists have studied ancient artifacts that predate Plato’s story and determined that they would have been destroyed by the flood writers describe in world religions. Additionally, paleontological evidence suggests that some species of animals were rendered extinct prior to the events described in Plato’s story, indicating that a significant flooding event must have occurred earlier. Finally, geological evidence indicates that land forms in particular regions have changed drastically since before Plato’s story, suggesting that large-scale flooding events must have occurred since then.

CAPM Portfolio’s

I know how to build a Markowitz Weighted Portfolio, and how to ‘hack it’, just up the quantities associated with higher beta’s which represents the Risk Premium (i.e. how much over the Risk Free Rate is expected as return, aka known as risk premium of the market, based on the DGS3MO).

But I let it resolve to optimal sharpe ratio and simply display the beta’s as derived from MDYG (SP1500).

So based on CAPM Expected Return (Average Risk Premium for past 5 years is .0142 (1.42%), the CAPM return is 4.33% + 1.42% * Portfolio Beta of 1.00116592, which comes out to be 5.75% for next quarter.

A different forecast, one based on Markowitz simulations has 9% for next quarter.

Another forecast based on an expected return factor model forecasted results using a model that has 13% MAPE, the weighted forecasted return is 13% for next quarter (i.e. 13% +/- (13%^2) (i.e. 13% +/- 0.0169%)

What’s frustrating is knowing I hit the ball out of the park when it comes to CAPM portfolio’s and Markowitz, but to know that those in academia that actively trade are not fans of the material they are hamstrung to teach. So I get various strong opinions about what works. Very cult of personality about methodologies, but not me. I’m open to trying as much as I can just for the opportunity to learn.

The Inefficient Stock Market is a gold mine in terms of what factors to look for. I’ve been doing my own research (FRED data, commodities, foreign exchanges, indexes, sectors, SP1500 prices, fundamentals, financial statements, Critiques of Piotroski, French Fama 3 and 5 Factor Models, Arbitrate Pricing Theory). The book suggests improved/revised factor models using a mix of financials and fundamentals offering 30 to look out for.

If it works and proves to match the projected expected returns within the risks shown. Then this could be used to borrow money on margin call knowing your returns are modeled/controlled for and you can make money on the spread, but it’s risky. Borrowed money is usually at the Risk Free Rate, so you aim for a risk premium return by controlling for risk.

The philosophy behind the filters is, “this vs that. Bifurcation.” Split everything somewhat subjectively to a simple filter no matter how complex the calculation is on the back end, aka a 1 or 0 is coded for every value with default being 0 (such as na’s), and add these filters together across ETF’s and sift the top results. Which allows me to focus on revising and expanding individual logic in factors encapsulated in sql and/or python files. For example modifying thresholds which affect proportion of occurrence for a given factor(field). If query logic is based on median’s, it’s easy to get 50% of the values every time for each factor.

Stock Database

I finished the database I was working on for stock market data.

for the sp1500
SEC filings for financial statements
as well as what yahoo offers (financial statements for annual and quarterly, earnings trend estimates)
commodities
bonds
fred data for econometrics

the whole etl job finishes now in about 30 minutes which I’ve encapsulated into a single folder

I intend to use tableau to parse through this and create some choice dashboards

once I finalize on the dashboards, I then intend to migrate them over to flask

Dask pygam nested cross validation

I combined new inferences from a few sources on how to do Nested Cross Validation so I [re-]wrote it for pygam that derives all combination of terms to find best subsets and then distributes the work across a DASK cluster.

Income and Population are the best predictor terms for Poverty using GAM (using 10 for k for folds).

Code: https://github.com/thistleknot/python-ml/blob/master/code/pyGam%20Nested%20Cross%20Validation%20bestSubsets%20Dask.ipynb
Non-dask version: https://github.com/thistleknot/python-ml/blob/master/code/pyGam%20Nested%20Cross%20Validation.ipynb