Comments (11)
I think you are not successfully reading the input. This indicates you don't end up producing trials to analyze. If you've modified the code, I think it's somewhere in your modification.
from aas.
but I only modify 4point:
1.class RunRisk(private val spark: SparkSession) extends java.io.Serializable
2.modify path
3.modify val formatter = DateTimeFormatter.ofPattern("d-MMM-yy",Locale.ENGLISH)
4.
import java.util.Locale
import org.apache.log4j.Logger
import org.apache.log4j.Level
@srowen
could you help me?thanks ~~~
um....my environment is:
ubuntu 18.10
spark 2.3.1
JDK 1.8.0_201
scala 2.11.8
from aas.
if I did NOT modify the above former three point ,there will be other error logs....
from aas.
I use trials.show(),the content is:
+-----+
|value|
+-----+
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
| NaN|
+-----+
from aas.
I found
for (i <- 0 until numTrials) {
val trialFactorReturns = multivariateNormal.sample()
val trialFeatures = featurize(trialFactorReturns)
trialReturns(i) = trialReturn(trialFeatures, instruments)
}
this code make trialReturns(i) from 0 ->NaN
from aas.
I traced back and found totalReturn is NaN
from aas.
when CVCY.csv is in folder stocks/ then totalreturns will be NaN
is it Right?
from aas.
The return value type of readGoogleHistory is Array[(LocalDate, Double)
while the type of allStocks is Iterator[Array[(LocalDate, Double)]](auto inference by intellij with scala 2.11.8)
it seems not works well in
val allStocks = files.iterator.flatMap { file => try { Some(readGoogleHistory(file)) } catch { case e: Exception => None } }
Could you give me more tips?
@srowen
much thanks~
from aas.
The code compiles and runs fine. I'm not even clear what you're saying the problem is; allStocks
is an iterator over results of readGoogleHistory
.
I think you don't have the data downloaded. You need to download or unzip it from the .zip file provided. This code doesn't work out of the box any more because the original data moved, so there are extra steps here.
from aas.
stocksReturns.map(linearModel(, factorFeatures)).map(.estimateRegressionParameters()).toArray
I found this code returns a lot of NaN
and I check stocksReturns and factorFeatures:
stocksReturns is not null ,but it contains a lot of 0
factorFeatures is not null ,but it contains a lot of 0
3 files in folder factors/
and only CVCY.csv in folder stocks/.(this help me to reproduce the error faster,same error with all *.csv in folder stocks/ )
do you know how to modify it?
(of course I know it's absolutely OK in your platform)
much thanks~
@srowen
It seems that this model fails to be created.
from aas.
I check the doument of estimateRegressionParameters()
it said:
If there is no variance in y, i.e., SSTO = 0, NaN is returned.
in my stocksReturns and factorFeatures,
there's so much 0 -------->estimateRegressionParameter return NaN.
which may be the reason why ch09-code fails in my platform.
And Also,
If I do NOT use all the *.csv in folder stocks/ ,the ch09-code will succeed.
If I use spcecific *.csv(such as only CVCY.csv),it will reproduce the above error.
if I use all *.csv file in folder stocks/,it will also reproduce the above error.
@srowen
So I guess the reason of failure is due to the API defect,or the data need to be pre-preprocessed before fed into it.
from aas.
Related Issues (20)
- Pyspark implementation of these HOT 1
- Chapter 9: Getting the Data: 403 Forbidden results HOT 7
- Chapter 10 LeftOuterShuffleRegionJoin issue HOT 6
- Importing projects into IntelliJ HOT 2
- [ch-03] match Error with function: buildArtistAlias HOT 3
- transform RDD [(String, String)] to DATASET [ (String, String)] HOT 1
- Ch 03: audioscrobbler data not available HOT 2
- NullPointerException in chapter9 HOT 1
- ValueError: cannot decompress PACKBITS in chapter11 HOT 4
- [Question] Chapter 3 - Use the CROSS JOIN syntax to allow cartesian products between these relations HOT 4
- java.lang.NoClassDefFoundError: scala/reflect/internal/Trees HOT 1
- [Question] Chapter 2 - about function "scoreMatchData" HOT 5
- but which data set to download from https://ti.arc.nasa.gov HOT 1
- Increased maven memory for build project HOT 1
- Chapter 1, page 46 HOT 13
- Chapter 3. Recommending Music and the Audioscrobbler Dataset HOT 2
- Chapter 3: Convert PySpark DataFrame to Pandas HOT 4
- Chapter 3: ROC HOT 4
- Where is the code for AA with PySpark Book by Akash Tandon? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aas.